Don't put it in the AutoClose macro.
Put it in a macro that intercepts the print commands. Print is updating
fields in your document (making changes).
There is a page on the vba faq of the MVP FAQ site on intercepting commands.
You would need to intercept the FilePrint and (I think) FilePrintDefault
commands.
If your generated document is never saved, save it to something like
deleteme.dot (overwriting existing file) in your code.
Note, I'm over my head here and tossing off speculations and ideas, not
things I've done.
--
Charles Kenyon
Word New User FAQ & Web Directory:
<URL:
http://addbalance.com/word/index.htm>
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL:
http://addbalance.com/usersguide/index.htm>
See also the MVP FAQ: <URL:
http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
Alpha said:
Hi Charles,
Thanks for the prompt reply. Basicly, the user runs our applicaton which
invokes a Word template (we have VBA code in these templates that the user
runs) and it prints the documents either with preview or no-preview. If I
put the statment Activedocument.Saved = TRUE at the end of our VBA code then
it still pops up the message window asking to save the doc or not. The only
time it doesn't ask is if you preview the doc and made no changes and don't
click to print.
I created and inserted the following auto macros and inserted into our
code at the beginning afterthe variable delcaration part:
sub Autoclose()
Activedocument.saved = TRUE
end sub
This would work in our office when I ran tests. It supresses the pop up
message window. I tried printing, changing the document then close the Word
applicaiton and no message box would pop up. I applied this solution to the
customer system and it doesn't work.
Also, These templates with VB codes are digitally signed and the
Macro->Secrutiy setting is set as high and accepts this Digital Signed
Macros.