ASK fields do not update bookmarks in Microsoft Word template

I am creating a template document for my office that uses a series of ASK fields to populate some bookmarks with pro-forma content.

The only VBA in the template is used to update fields on a new document creation:

Private Sub Document_New()
  ThisDocument.Fields.Update
End Sub

Right now, when I create a new document from the template, all of the ASK prompts come up. However, upon completion of the last prompt, the bookmark values do not update (even after Ctrl+A, F9). If I go through the prompts a second time, it does work.

Additionally, whenever I go to close or save the new document that I created from the template, I am greeted with this prompt:

On close prompt

Although I am not sure how I have made edits to the original template. This prompt comes up even though all I have done is respond to the ASK field prompts.


Solution 1:

Although obvious in retrospect ThisDocument inside the template file always refers to the template file (i.e. not the file you have created from the template).

This resulted in strange - but not unexpected - behaviour when using the template:

  1. The ASK prompts were updating the bookmarks in the template file
  2. Because these bookmarks are in the template and not the new document you have created, the bookmarks in the new document will not be updated at all
  3. Running the ASK prompts the second time manually would then update the bookmarks in the new document
  4. Because I updated the bookmarks in the template file, the template modification prompt would appear when closing the document

The simplest way I found to address this issue was to simply change ThisDocument to ActiveDocument:

Private Sub Document_New()
  ActiveDocument.Fields.Update
End Sub

Now, calling this macro will only update the fields in the active document which (unless you are editing the template) will always refer to the blank document you had just created.