In today’s post, we are glad to show you 2 quick methods to batch add square brackets to note numbers in your Word document.
Whenever drafting a long document, we are likely to insert footnotes and endnotes. We know there are options for the mote number format. However, there is no built-in number style with square brackets. What we will discuss in the coming texts are the 2 solutions to address such an issue.
Method 1: Utilize the “Find and Replace” Function
- To begin with, click “Home” tab in the target document.
- Then click “Replace” command in “Editing” group to open “Find and Replace” dialog box.
- Now if you are working with footnotes, enter “^f” in “Find what” text box.
- Enter “[^&]” in “Replace with” text box.
- Next click “Replace All”.
- The next thing you see is that all footnote numbers are in square brackets. Click “OK” to close the message box.
Besides, to add square brackets to endnotes, simply replace “^f” with “^e” in “Find what” text boxes.
Method 2: Run Word Macro
- First and foremost, press “Alt+ F11” in Word to trigger the VBA editor.
- Next click “Normal” and then the “Insert” tab.
- On the drop-down menu, choose “Module”.
- Then double click on the newly inserted module to open the editing area on the right side.
- And paste the bellowing macro there:
Sub AddBracketForFootnoteAndEndnote() Application.ScreenUpdating = False Dim objRange As Range With ActiveDocument ' add bracket for footnotes. If ActiveDocument.Footnotes.Count > 0 Then Call UpdateFootnoteRange(.Range) For Each objRange In .StoryRanges If objRange.StoryType = wdFootnotesStory Then Call UpdateFootnoteRange(objRange): Exit For End If Next MsgBox ("All footnotes have been added brackets.") Else MsgBox ("There is no footnote in this document") End If ' add bracket for footnotes. If ActiveDocument.Endnotes.Count > 0 Then Call UpdateEndnoteRange(.Range) For Each objRange In .StoryRanges If objRange.StoryType = wdEndnotesStory Then Call UpdateEndnoteRange(objRange): Exit For End If Next MsgBox ("All endnotes have been added brackets.") Else MsgBox ("There is no endnote in this document") End If End With Application.ScreenUpdating = True End Sub Sub UpdateFootnoteRange(objRange As Range) With objRange.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^f" .Replacement.Text = "[^&]" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With End Sub Sub UpdateEndnoteRange(objRange As Range) With objRange.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^e" .Replacement.Text = "[^&]" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With End Sub
- Now place insertion pointer inside the first macro and click “Run”.
- Then first there is a message box saying square brackets have been added to all footnote numbers.
- Next there is the second one saying the conversion is complete in all endnote numbers.
Here is the result we got:
Prevent from Document Loss
With data as valuable as what we stored, we couldn’t afford to take any chances. Therefore, it would be wise to back up important files before taking any move with potential risk of ruin them unless you want to get a damaged doc.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls corruption and pdf repair software products. For more information visit www.datanumen.com