Hi,
I have a document containing ASK and Ref fields.
It also contains an Open event macro to trigger the ASK popups and update the Refs accordingly.
The macro fires when I open the 'actual' template, but it does not fire (or transfer) to the new document created by the template. Hence, the ASK fields do not pop up. This makes sense as the document created by the template is a *.docx.
Is there a way to achieve this auto update of the fields?
I cannot store the code in my normal template as I plan to distribute the file to many recipients.
TX
Template macro to update ASK and Ref fields
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Template macro to update ASK and Ref fields
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78930
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Template macro to update ASK and Ref fields
How about calling the Document_Open code from the Document_New event?
As long as the .docx document is attached to the template, it should be able to run the code in the template.
As long as the .docx document is attached to the template, it should be able to run the code in the template.
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Template macro to update ASK and Ref fields
As simple as that! ![ThumbUp :thumbup:](./images/smilies/thumbup.gif)
Cheers
![ThumbUp :thumbup:](./images/smilies/thumbup.gif)
Cheers
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 641
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Template macro to update ASK and Ref fields
An AutoOpen macro in the template should do the same thing, so long as the template is attached to the document.
Do you perhaps want Document_New or AutoNew in the template to be fired upon the creation of a new document?
Do you perhaps want Document_New or AutoNew in the template to be fired upon the creation of a new document?
![Cheers :cheers:](./images/smilies/cheers.gif)
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Template macro to update ASK and Ref fields
Hi Charles.
The intention was to have the fields update in the new *.docx copy of the template.
The Document_New event Hans suggested resolved the issue.
Cheers
The intention was to have the fields update in the new *.docx copy of the template.
The Document_New event Hans suggested resolved the issue.
Cheers
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.