Template macro to update ASK and Ref fields

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Template macro to update ASK and Ref fields

Post by Rudi »

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
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
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

Post by HansV »

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.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Template macro to update ASK and Ref fields

Post by Rudi »

As simple as that! :thumbup:

Cheers
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Charles Kenyon
5StarLounger
Posts: 641
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Template macro to update ASK and Ref fields

Post by Charles Kenyon »

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?

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Template macro to update ASK and Ref fields

Post by Rudi »

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
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.