g8r777
09-28-2011, 04:06 PM
I have slowly converted some company forms to DOTM templates to prevent users from making changes. Inside the documents I use quite a bit of VBA code.
I know when a user saves a DOTM file to a DOCM or DOCX file that the vba code does not copy over but that a reference to the original DOTM file is placed in the vba code and that all the original code should still work in the new DOC file as long as there is access to the original template.
This works most of the time but I have had multiple users manage to save or copy a DOC file and lose the reference to the template. I'm not sure how this happens. I cannot recreate it. I can, however, verify that they are working from some kind of copy of the original template that has just lost the reference (and therefore all vba functionality).
Is there a way to have the vba code saved to the new DOC file when saving from the template? For example, have some code that runs "on save" that copies the entire vba project from the template to the new DOC file.
Not sure if that is possible but it would be extremely helpful.
I know when a user saves a DOTM file to a DOCM or DOCX file that the vba code does not copy over but that a reference to the original DOTM file is placed in the vba code and that all the original code should still work in the new DOC file as long as there is access to the original template.
This works most of the time but I have had multiple users manage to save or copy a DOC file and lose the reference to the template. I'm not sure how this happens. I cannot recreate it. I can, however, verify that they are working from some kind of copy of the original template that has just lost the reference (and therefore all vba functionality).
Is there a way to have the vba code saved to the new DOC file when saving from the template? For example, have some code that runs "on save" that copies the entire vba project from the template to the new DOC file.
Not sure if that is possible but it would be extremely helpful.