2 Quick Methods to Batch Add Square Brackets to Note Numbers in Your Word Document

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

  1. To begin with, click “Home” tab in the target document.
  2. Then click “Replace” command in “Editing” group to open “Find and Replace” dialog box.
  3. Now if you are working with footnotes, enter “^f” in “Find what” text box.
  4. Enter “[^&]” in “Replace with” text box.
  5. Next click “Replace All”.
  6. The next thing you see is that all footnote numbers are in square brackets. Click “OK” to close the message box.Click "Home"->Click "Replace"->Enter texts in both text boxes->Click "Replace All"->Click "OK"

Besides, to add square brackets to endnotes, simply replace “^f” with “^e” in “Find what” text boxes.

Method 2: Run Word Macro

  1. First and foremost, press “Alt+ F11” in Word to trigger the VBA editor.
  2. Next click “Normal” and then the “Insert” tab.
  3. On the drop-down menu, choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  4. Then double click on the newly inserted module to open the editing area on the right side.
  5. 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
  1. Now place insertion pointer inside the first macro and click “Run”.Paste codesPaste codes->Click "Run"
  2. Then first there is a message box saying square brackets have been added to all footnote numbers.Message box saying footnote numbers have been added with square brackets
  3. Next there is the second one saying the conversion is complete in all endnote numbers.Message box saying endnote numbers have been added with square brackets

Here is the result we got:Effect of running macros

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

Comments are closed.