Copy procedure in ThisDocument to another document
Posted on 2014-09-15
I want to copy one or more procedures contained in Template A's ThisDocument location to my active document's ThisDocument location. Let me see if I can make this more clear.
Template_A contains the following macro in the 'ThisDocument' area:
.AddItem "Item 1"
.AddItem "Item 2"
I want to programmatically copy the procedure called AppResps_GotFocus into my current document, and it needs to go into the ThisDocument area as well.
Template_A will have a project name given to it of 'ProjectA' if that helps with referencing it. It will also be open in the Editor so there is no need to locate where the template is on the hard drive.
Just wondering if anyone has any code that does that or can shed some light on what I need to use.
This will be done programatically when the user creates a new template and I do not want to manually copy the code beforehand. The reason is that the procedures will change a lot over time, so doing this at 'run-time' is the most efficient solution.
I am using Word 2003. Thank you for your help.