Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-25-2023, 12:14 AM
Mazarin07 Mazarin07 is offline Relocation of footnotes in the body text and formatting them as needed Windows 10 Relocation of footnotes in the body text and formatting them as needed Office 2019
Novice
Relocation of footnotes in the body text and formatting them as needed
 
Join Date: Jan 2023
Posts: 2
Mazarin07 is on a distinguished road
Default

There is another, shorter approach, but this ends with an "Object not found" error message for line "oFootnote.Delete".
Code:
Sub MoveFootnotes()
    Dim oFootnote As Footnote
    Dim oRange As Range
    Dim refNumber As String
    Dim text As String

    For i = ActiveDocument.Footnotes.Count To 1 Step -1
        Set oFootnote = ActiveDocument.Footnotes(i)
        Set oRange = oFootnote.Reference
        refNumber = oRange.text
        text = oFootnote.Range.text
        oRange.text = "[" & refNumber & ": " & text & "]"
        oRange.Font.Color = wdColorRed 'color the reference number to red
        oRange.HighlightColorIndex = wdGray25 'highlight the text in 25% gray
        oFootnote.Delete
    Next
End Sub
If I delete line "oFootnote.Delete" (or simply put an ' sign to make it a remark) the macro works fine, but the end result is that footnote text placed inline is red (in addition to having gray highlight), and the reference numbers are missed, there is a question mark everywhere instead of them.
Reply With Quote
 

Tags
footnotes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Relocation of footnotes in the body text and formatting them as needed Preserving formatting when turning footnotes into regular text thiagoafdoria Word VBA 2 01-08-2020 01:25 PM
Relocation of footnotes in the body text and formatting them as needed Help needed with moving footnotes Last Chance Word VBA 15 06-07-2019 07:44 PM
Normal, Body Text or Body Text Indent? Riddles Word 3 04-08-2017 05:06 PM
Relocation of footnotes in the body text and formatting them as needed Help with Tracking: Bold in body text, but not in Footnotes Bobbety Word 3 05-17-2015 11:17 PM
Relocation of footnotes in the body text and formatting them as needed Formatting footnotes causes double footnote numbers geirrosset Word 5 10-29-2014 05:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:26 AM.


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