Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2019, 12:16 PM
NoCalScribe NoCalScribe is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2019
Posts: 4
NoCalScribe is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 10-25-2019, 05:15 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 10-25-2019, 06:44 AM
NoCalScribe NoCalScribe is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2019
Posts: 4
NoCalScribe is on a distinguished road
Default

Perfect - thanks again, Greg!
Reply With Quote
Reply



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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft