PDA

View Full Version : [SOLVED:] TEMPLATE to save as macro enabled doc



MINCUS1308
10-02-2014, 01:34 PM
I have a ms word 2010 template document that has a macro running in the background.
I when the user try's to exit/save the document I want to ensure that the file is a macro enabled document.

is the best method of doing this to run a macro on the open event and do a
thisdocument.saveas2 ?
and if so what is the correct file format to use?

macropod
10-02-2014, 01:50 PM
Unless you're going to add some code to the document, which means giving trusted access to the VBA project model (generally not a good idea and can't be done programmatically), Why would you want to do that? A docx file already has access to all the code in its template.

As for the answer to your question, did you look at the SaveAs2 method in the VBE help file?

MINCUS1308
10-06-2014, 05:16 AM
hmm... so it would seem. I assumed since the template was saving the created file as a non macro enabled doc that I would lose the coding behind it. When I tested my hypothesis I got the expected result. I must have done something weird. Thank you for prompting me to re-investigate that.

I did look at the saveas2 vbe file, but i hadnt ever used it before and was only curious if there was a better method for accomplishing the same thing.

Thank you for your assistance.