dotm creates new document - how to remove the reference to the template?
Question
I have a dotm with macros stored in it. When a new document is created, there is a reference to the dotm file (if you're looking at the project in VBA editor) which I need to eliminate.
Is it somehow possible to do this with VBA code?
Solution
You can sever the original reference by replacing it with a reference to another template using the Attachedtemplate
property. For example:
Private Sub Document_New()
ActiveDocument.AttachedTemplate = "C:\Users\Joe\AppData\Roaming\Microsoft\Templates\Normal.dotm"
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow