I have a macro that crashes so totally that it crashes Word, leaving no error messages. I want the macro to write a log to a .txt file, so that when Word crashes, the .txt file will still be open and I can use the log to figure out what’s going on.
I can use this shell command to open notepad:
Call shell (“notepad.exe”, vbMinimizedFocus)
However, I can’t figure out how to name the file. Adding the desired filename to the shell command listed above makes the vba look for a .txt file with that name – which doesn’t exist yet.
Can someone help me do the following:
1) Use a Word macro to open a new text file
2) Give the text file the same name as the word file running the macro
3) Append text to the text file during runtime
Any help (or better ideas!) appreciated.