VBA & Macro Problems

Convert Bracketed References to Footnotes with a Word VBA Macro

Tauseeq MagsiTauseeq Magsi Nov 25, 2026 869 views

Question details

Convert numeric bracketed references such as [1] and [2] into Word footnotes using a VBA macro.

Convert Bracketed References to Footnotes with a Word VBA Macro
Product
Microsoft Word
Device & OS
not provided
Scenario
A document contains bracketed numeric references that need corresponding footnotes.
Observed behavior
Each bracketed reference should become a superscript footnote marker with a corresponding footnote.
Before you start

Check that the references use numeric brackets such as [1] or [23], and identify the source text you want to put in the footnotes. Use a desktop version of Word that supports VBA, and save the document as a macro-enabled .docm file if you want to retain the macro.

Solution 1Recommended

Use a VBA macro to replace bracketed numbers with footnotes

Use this method to convert numeric bracketed references in the main document body into automatically numbered Word footnotes.

The macro creates a footnote for each match and puts the original number in placeholder text such as “Reference 1.” It does not retrieve source details; replace the placeholders with the actual citations afterward.

Word assigns footnote numbers automatically. These numbers may differ from the original bracketed numbers, especially if the document already contains footnotes. Word normally formats footnote markers as superscript.

1
Open the VBA editor

In desktop Word, open the document and choose Developer > Visual Basic. If Developer is not visible, enable it through Word's ribbon customization settings.

2
Insert the macro

In the VBA editor, select the document project, choose Insert > Module, and paste this code: Sub BracketedReferencesToFootnotes() Dim doc As Document Dim hit As Range Dim originalNumber As String Dim nextStart As Long Dim matchStart As Long Set doc = ActiveDocument nextStart = 0 Do Set hit = doc.Range(Start:=nextStart, End:=doc.Content.End) With hit.Find .ClearFormatting .Text = "\[[0-9]{1,}\]" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True If Not .Execute Then Exit Do End With matchStart = hit.Start originalNumber = Mid$(hit.Text, 2, Len(hit.Text) - 2) doc.Footnotes.Add Range:=hit, Text:="Reference " & originalNumber nextStart = matchStart + 1 Loop End Sub

3
Run the macro

Return to Word, choose Developer > Macros, select BracketedReferencesToFootnotes, and click Run. Run macros only when you trust their code.

4
Complete the citations

Review each footnote at the bottom of the page and replace its “Reference” placeholder with the appropriate citation text. Check that the automatic marker numbers meet your needs.

Use a VBA macro to replace bracketed numbers with footnotes
Scope of the search: The macro searches the main document body for brackets containing digits only. It does not convert references in headers, footers, text boxes, or existing footnotes, or match formats such as [1, 2].
Free Microsoft Office alternative

Edit documents and add footnotes with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface and support for Microsoft Office formats, making it easy to move documents between suites. In WPS Writer, you can add and edit footnotes manually; it does not fix Word's VBA macro workflow.

Add and edit footnotes in WPS WriterOpen and edit Microsoft Word DOC and DOCX filesUse familiar document-editing tools for an easier transitionWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Will the footnote marker keep the original bracketed number?

Not necessarily. Word automatically numbers the new footnotes in document order. The macro preserves the original number in each footnote's placeholder text so you can identify the citation.

Does the macro add the full citation text?

No. It adds placeholder text such as “Reference 1.” After running the macro, click each footnote and replace the placeholder with the matching citation.

Can the macro convert references like [1, 2] or [Smith, 2020]?

No. Its wildcard pattern matches a single sequence of digits inside brackets, such as [1] or [23]. Other reference formats require a different search pattern and handling.

Why should I save the document as a .docm file?

A .docm file can retain the VBA macro with the document. In Word, choose File > Save As and select Word Macro-Enabled Document if you want to keep the macro for later use.