MTP
07-18-2013, 09:53 AM
My company uses a program that exports data into a Word template.
I would like to alter the appearance of the Word document with a macro. I wrote a macro in the template and called it AutoNew() so it runs when the external application creates a new file based on the template. I used OnTime to delay the running of the macro since it can't format something the external application hasn't put into the document yet.
This works OK, but somehow turns on ScreenUpdating (so the document takes longer to create), and if I put the delay with OnTime for very long, the external application throws an error that it can't export to Word. (The document gets header information and not the body of the report.) So I can't format anything at the end of the report, since I get an error by trying to wait until the report is done.
I have a couple of questions:
The external application turns off screen updating. Why would running my macro turn it back on? Even if I try to set it back to false within my macro, it doesn't work.
Is there any way besides OnTime to delay running of my macro until after the external application has put all its information into the document?
I would like to alter the appearance of the Word document with a macro. I wrote a macro in the template and called it AutoNew() so it runs when the external application creates a new file based on the template. I used OnTime to delay the running of the macro since it can't format something the external application hasn't put into the document yet.
This works OK, but somehow turns on ScreenUpdating (so the document takes longer to create), and if I put the delay with OnTime for very long, the external application throws an error that it can't export to Word. (The document gets header information and not the body of the report.) So I can't format anything at the end of the report, since I get an error by trying to wait until the report is done.
I have a couple of questions:
The external application turns off screen updating. Why would running my macro turn it back on? Even if I try to set it back to false within my macro, it doesn't work.
Is there any way besides OnTime to delay running of my macro until after the external application has put all its information into the document?