When you need to select all the footnotes in a document, these two manual methods--or one VBA procedure--will get the job done.
Most Word users learn quickly that pressing Ctrl+A selects the entire document--except headers, footers, footnotes, and endnotes. Rory was hoping for a macro that would select and update the field codes in his footnotes. His scheme is a bit of genius and involves field codes, hyperlinks, and cross-references. It's slick, but the field codes in the footnotes don't update automatically. Field codes generally don't. You must select them and press F9 to force them to update. Selecting each field code manually is tedious--and fortunately, unnecessary, so Rory doesn't need a macro. There are two ways to select footnotes and update the fields without using VBA code. I'll also provide a macro, in case that's what Rory truly needs.
I'm using Word 2016 (desktop), but these methods will work in earlier versions. The browser version doesn't display footnotes. We'll be updating field codes; if you don't know how to enter field codes, read 10 things you need to know about using Word fields. You can follow that article without reading this article first. For your convenience, you can download the demonstration Word document and the VBA module.
Perhaps the easiest way is to use Ctrl+A. Earlier I said it doesn't work with footnotes, but it does if you know this simple trick. To see how, we'll use the basic document in Figure A. It contains two footnotes, and each footnote contains a NUMPAGES field. (This field displays the total number of pages in the document.) When you enter each field code manually, it displays the correct number of pages. If you add pages, neither updates, as you can see in Figure A.
Neither NUMPAGES field in either footnote updates when you add a new page.
Now, let's update those field codes as follows:
- Click anywhere inside any footnote in the document.
- Press Ctrl+A to select all footnotes, but only footnotes (Figure B).
- Press F9 to update any fields in all the selected footnotes and click Yes to see the updated fields, as shown in Figure C. Word warns you that you can't undo the action, but you can by pressing Ctrl+Z.
Select all footnotes with Ctrl+A.
Update all the fields in all the footnotes.
It's like magic! As I said, most users know about Ctrl+A, but they don't realize how versatile it is.
SEE: 30 things you should never do in Microsoft Office (free TechRepublic PDF)
The second method has no advantage over the first, but to be comprehensive, we should consider it. This time, we'll use the Select command. The only caveat is that your footnotes must use similar formatting. In this case, it works because Word uses the Footnote Text style for footnotes. In fact, I increased the font size for the style in the demonstration file so they're easier to see in the figures.
To continue, let's use Select to update the fields in the footnotes, as follows:
- Click inside any footnote in the document.
- Click the Home tab.
- From the Select dropdown in the Editing group, choose Select All Text With Similar Formatting (No Data), as shown in Figure D.
- Press F9 and then click Yes (once for each footnote, which is a bit tedious).
Select all footnotes using the Select option.
Rory's request for a macro isn't unfounded. Both manual methods require that you remember to update the fields. The process is simple, but remembering often isn't. Therefore, a macro might be appropriate if you can find a way to call it that you won't have to remember, such as saving, closing, or printing the file.
The macro in Listing A is similar to the manual Ctrl+A process. If the Count method returns 0, there are no footnotes and the macro does nothing. When Count returns a value other than 0, the If statement selects all foodnotes. Then, the Update method updates the fields. You could use the same procedure to select all of the endnotes; simply replace the Footnotes collection with the Endnotes collection
Sub UpdateFootnotes() 'Update fields in all footnotes. Dim doc As Document Dim rng As Range Set doc = ActiveDocument If doc.Footnotes.Count <> 0 Then 'Select all footnotes. Set rng = doc.Footnotes(1).Range rng.WholeStory rng.Select 'Update all fields. Selection.Fields.Update End If End Sub
To enter the macro, press Alt+F11 to launch the Visual Basic Editor (VBE). In the appropriate Word project --select it using the Project Explorer to the left---open the ThisDocument module and add the code there (Figure E). Note: Don't copy and paste from this web page. Enter the code manually or import the code using the downloadable ThisDocument.cls file.
Add the macro to ThisDocument in the VBE.
To run the macro, click the Developer tab. Then, click Macros in the Code group. In the resulting dialog, select UpdateFootnotes (Figure F), click Run, and then click Yes to continue. You can add the macro to the Quick Access Toolbar (QAT), add a macro group to the Ribbon, or find some other internal process to trigger it.
This macro updates all the fields in all footnotes.
Three ways are better than one
It doesn't matter which method you use to update the fields in the footnotes. What matters is that you have a choice! Rory's happy with the first method that uses Ctrl+A to select only the footnotes. It's a neat trick that most users don't know about.
Send me your question about Office
I answer readers' questions when I can, but there's no guarantee. Don't send files unless requested; initial requests for help that arrive with attached files will be deleted unread. You can send screenshots of your data to help clarify your question. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. I'm not reimbursed by TechRepublic for my time or expertise when helping readers, nor do I ask for a fee from readers I help. You can contact me at email@example.com.
- Microsoft Office 365 now has 120 million business users (ZDNet)
- How to use VBA to sum Excel values by fill color (TechRepublic)
- How to add a custom priority field to Outlook tasks (TechRepublic)
- Office Q&A: Two easy ways to repeat text in a Word document (TechRepublic)