#1
|
|||
|
|||
Adding footnote number as part of footnote text – part deux
I had a footnote referencing text adaptation that Greg Maxey provided a macro for.
I wanted to add the footnote reference number as {Note 1}, {Note 2} between my footnote reference number and the footnote text – the number needed to be static so that it would retain the original footnote number even if new footnotes were added. The macro worked great and is below. I now have a new document where the footnotes contain a lot of formatted text such as italics, small caps and colored text along with the regular footnote text. The macro appears to extend the formatting of whatever the first character of the footnote text is through the remainder of the text and including the created {Note + fn#} so that I can end up with a footnote in all italics, all small caps or all red text., depending on the formatting of the first word. This wasn’t an issue previously as the footnotes were all Times New Roman 10pt. How can the macro be adapted to preserve the text as currently formatted but put the bracketed Note + number in Times New Roman 10pt before it? Thanks for any help! Option Explicit Private m_oFN As Footnote Sub ScratchMacro() For Each m_oFN In ActiveDocument.Footnotes m_oFN.Range.Text = "{Note " & fcnGetFootnoteReferenceIndex & "} " & m_oFN.Range.Text Next lbl_Exit: Exit Sub End Sub Function fcnGetFootnoteReferenceIndex() As String With m_oFN With .Reference.Characters.First .Collapse .InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, m_oFN.Index fcnGetFootnoteReferenceIndex = .Characters.First.Fields(1).Result .Characters.Last.Fields(1).Delete End With End With lbl_Exit: Exit Function End Function |
#2
|
|||
|
|||
Code:
Sub ScratchMacro() For Each m_oFN In ActiveDocument.Footnotes m_oFN.Range.InsertBefore "{Note " & fcnGetFootnoteReferenceIndex & "} " '& m_oFN.Range.Text Next lbl_Exit: Exit Sub End Sub |
#3
|
|||
|
|||
Perfect - thanks again, Greg!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding footnote number as part of footnote text | NoCalScribe | Word VBA | 3 | 07-15-2019 07:20 PM |
Space between footnote number and footnote text | Sabya | Word | 6 | 07-29-2018 02:30 PM |
No space between footnote number and footnote | cgp1689 | Word | 6 | 10-13-2015 08:24 AM |
Extracting certain text before footnote number | Taisir | Word VBA | 6 | 11-26-2014 12:27 AM |
Footnote text is not aligned with the corresponding number | Patrick1988 | Word | 0 | 08-28-2010 09:33 PM |