Hello VBA experts! I have made a Word VBA module to save a copy of a file to specific locations and send the file in an email attachement, all based on different user variables. It all works well, except 1 element.
The user works in a document (report that changes during the progress of a project, from a table-based template) which then have to be saved and sent dependent on which division and the progress. The user works in one personal file that they can update.
My macro is initiated by user choice in a User Form. The User Form open on Document_Close(), to avoid people forgetting to send the information off.
The document is then copied using the Sub below:
This creates a exact copy of the document that the macro then edits, mostly removing tables, then saving it to a location and sending it to specific people.Please Login or Register to view this content.
I'd then like to close the file automatically, which I do by using SaveDoc.Close SaveChanges:=wdSaveChanges. Here I run into trouble.
The "SaveDoc" copy of my file is saved as .docx, but apparently still contains it's own, copied macro, because the original .dotm file is still open. Closing the copy file means a copy of the original User Form pops up. I'd like to avoid this, as it can confuse the users. How can I avoid this happening? Can I prevent the SaveDoc file from opening User Form, or do something else?
I have difficulties sharing the full code, as it contains a bunch of internal names, projects and addresses. I hope You can help regardless.
Thank You,
GregersDK
Bookmarks