How to auto update field codes when reopen document in Word?
In Word document, we can insert the document name by using the fields, but if the document has been renamed, the file name filed cannot be updated automatically. In this tutorial, I introduce the way to auto update all field codes after reopening the document in Word.
In Word, there is no built-in function can update the inserted fields, except the VBA code.
1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window, double click ThisDocument in the left pane to open the ThisDocument (Code) window.
2. Copy and paste below code to the ThisDocument (Code) window.
VBA: Refresh field codes when reopen the document
Sub AutoOpen() 'UpdatebyExtendoffice20180830 Dim xRange As Range Dim xFiled As Field For Each xRange In ActiveDocument.StoryRanges For Each xFiled In xRange.Fields xFiled.Update Next Next End Sub
3. Click to save the code in Microsoft Visual Basic for Applications window, a Microsoft Word dialog pops out, click No to go to the Save As dialog.
4. In the Save As dialog box, select a folder to save the document, name it as you need, select Word Macro-enabled Document from the Save as type drop-down, and then click the Save button. See screenshot:
From now on, every time you open the Macro-enable document, all field codes will be updated automatically.
Note: Make sure the Enable all macros (not recommended; potentially dangerous code can run) option is checked in Trust Center dialog (Click File > Options > Trust Center > Macro Settings).
Tabbed browsing & editing multiple Word documents/Excel workbooks as Firefox, Chrome, Internet Explore 10!
You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Word documents or Excel workbooks in one Word window or Excel window, and easily switch between them by clicking their tabs.
Recommended Word Productivity Tools
- Complicated and repeated operations can be done one-time processing in seconds.
- Insert multiple images across folders into Word document at once.
- Merge and combine multiple Word files across folders into one with your desired order.
- Split the current document into separate documents according to heading, section break or other criteria.
- Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 1 months agoUsually, I do not post comments on blogs, but I would like to say that this blog really forced me to do so! Thanks, for a really nice read. For instant support related to the AOL Desktop Gold Download please visit http://www.emailscustomercare.com/aol-desktop-gold-download/ for the best solution.