![microsoft word add field that will automatically update microsoft word add field that will automatically update](https://www.avantixlearning.ca/wp-content/uploads/2018/03/FieldDialogBoxinMicrosoftWord.png)
WdPrimaryFooterStory, wdEvenPagesHeaderStory, _ Private Sub UpdateFieldsInStory(iobjStory As Range)Ĭase wdMainTextStory, wdPrimaryHeaderStory, _ While Not (objStory.NextStoryRange Is Nothing)įor Each objTOC In ActiveDocument.TablesOfContentsįor Each objTOA In ActiveDocument.TablesOfAuthoritiesįor Each objTOF In ActiveDocument.TablesOfFiguresįor Each objIndex In ActiveDocument.Indexes
![microsoft word add field that will automatically update microsoft word add field that will automatically update](https://kranjac.files.wordpress.com/2011/08/image24.png)
The main document is one story, headers and footers another, graphics another, and so on.) There are actually two macros used in this approach you would run the UpdateAllFields macro in order to start the updating process.įor Each objStory In ActiveDocument.StoryRanges (A "story" is best viewed as a layer in your document. This approach bypasses any trickery and, instead, steps through each of the "stories" in a document and updates any fields found in those stories. There is another macro approach you can take, if desired. The following macro doesn't change the settings in the Word Options dialog box, but it does perform just enough of the printing sequence that it tricks Word into updating the fields. You could also use a macro to perform these tasks. You can press Esc or click the Home tab of the ribbon to abandon printing, and you should note that all the fields in your document are updated. Once you are to this point, the fields in the document should be updated because Word is anticipating that you are going to print. This displays the Print dialog box (Word 2007) or the printing options (later versions of Word).
MICROSOFT WORD ADD FIELD THAT WILL AUTOMATICALLY UPDATE UPDATE
Now, all you need to do when you want to update the fields is to press Ctrl+P.
![microsoft word add field that will automatically update microsoft word add field that will automatically update](https://www.thedoctools.com/word-macros-tips/wp-content/uploads/options-update-fields-before-printing.png)
(In Word 2007 click the Office button and then click Word Options. Before doing this "tricking," however, you'll want to follow these steps: First is to trick Word into thinking you are printing.
![microsoft word add field that will automatically update microsoft word add field that will automatically update](https://support.content.office.net/en-us/media/8e01cdff-a15d-49c0-8b63-2abedf318e92.png)
With this understanding in mind, there are a couple of things you can do. Thus, fields are not updated when you do other tasks, such as saving or using Save As. (This was before the days of doing most tasks online, electronically.) One of the artifacts related to this historical understanding is that Word doesn't update fields until you go to print. Historically, Word was developed with the understanding that your documents would eventually be printed. He would prefer it to just do it automatically. William has inserted a FILENAME field, but he still has to remember to open the footer and click there and press F9 to update it. He wants that filename to automatically update every time he saves the document, or at least when he uses "Save As" to create a new file. William needs to insert the filename in a table that is in a text box in the footer of a document (it is a client requirement to do it that way).