Document Editing Problems

Convert Word Footnotes to Formatted In-Text Citations with VBA

Steven ParkerSteven Parker Nov 27, 2026 870 views

Question details

Convert Word footnotes into tagged in-text citations while retaining character formatting and excluding the footnote reference marker.

Convert Word Footnotes to Formatted In-Text Citations with VBA
Product
Microsoft Word
Device & OS
not provided
Scenario
A user wants to replace footnote references in the document body with the corresponding footnote text enclosed in [ref] tags.
Observed behavior
The existing VBA macro removes formatting such as italics and small caps and leaves an unwanted box after the opening tag.
Before you start

Work on a copy of the document and turn off Review > Track Changes so that deleting footnotes does not leave tracked references behind. The example targets footnotes referenced in the main document body; test it on a few representative footnotes first.

Solution 1Recommended

Use FormattedText to replace footnotes with tagged citations

Use this macro to preserve character formatting and avoid copying the footnote marker into the citation.

The macro processes footnotes from last to first, inserts the tags at each reference, and copies the note text with FormattedText rather than plain Text. It removes a leading automatic reference marker and a final paragraph mark from the source range when they are present.

Test documents containing fields, multiple paragraphs, custom markers, or other complex footnote content separately; their results may need manual review.

1
Open the VBA editor

Open the document in Word, then select Developer > Visual Basic. If the Developer tab is hidden, enable it under File > Options > Customize Ribbon.

2
Add the macro

In the VBA editor, select Insert > Module and paste this code: Sub FootnotesToRefCitations() Dim d As Document Dim fn As Footnote Dim src As Range Dim pos As Long Dim i As Long Set d = ActiveDocument For i = d.Footnotes.Count To 1 Step -1 Set fn = d.Footnotes(i) Set src = fn.Range.Duplicate If src.End > src.Start Then If Left$(src.Text, 1) = Chr$(2) Then src.Start = src.Start + 1 End If If src.End > src.Start Then If Right$(src.Text, 1) = vbCr Then src.End = src.End - 1 End If pos = fn.Reference.Start d.Range(pos, pos).InsertBefore "[ref][/ref]" d.Range(pos + 5, pos + 5).FormattedText = src.FormattedText fn.Delete Next i End Sub

3
Run and check the result

In Word, select Developer > Macros, choose FootnotesToRefCitations, and select Run. Check the citations for retained italics and small caps, correct tag placement, and any remaining marker or unwanted spacing.

Use FormattedText to replace footnotes with tagged citations
The macro removes the original footnotes: Each footnote is deleted after its text is inserted into the document body. Review the converted copy before using it as the final document.
Free Microsoft Office alternative

Edit Word documents with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for editing Word documents. Its support for Microsoft Word formats makes it easier to move existing documents between the two applications, though it does not fix Word VBA macros.

Edit and review formatted document text in WPS WriterOpen and save Microsoft Word DOC and DOCX filesUse a familiar interface to make the transition from Microsoft Office easierWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro remove italics from footnote text?

Assigning a range's Text copies plain text rather than its character formatting. Use the source range's FormattedText to insert the note text while retaining formatting such as italics and small caps.

Why is there a box after the opening citation tag?

The copied footnote range may include the footnote reference marker. Check for a leading Chr(2) in the source range and exclude it before assigning FormattedText.

Why should the macro process footnotes from last to first?

Deleting a footnote changes the footnotes collection and renumbers the remaining notes. Looping from Footnotes.Count down to 1 avoids skipping items as they are deleted.

Can I run the macro with Track Changes enabled?

Turn off Review > Track Changes before running it. Tracked insertions and deletions can leave references and other markup that complicate the conversion.