View Single Post
 
Old 01-15-2022, 05:07 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The example document layout bears no relationship to the screenshot in your original message, so it comes as no surprise that the code intended for the screenshot layout doesn't work with the document layout. For that you would need
Code:
Sub Macro1()
Const sFind As String = "Footnote"
Dim sNote As String
Dim oRng As Range, oNote As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(sFind)
            sNote = ""
            With oRng
                .End = .Paragraphs(1).Range.End
                .Text = ""
                .MoveStart wdParagraph
                .End = .Paragraphs(1).Range.End
                .MoveEnd wdParagraph
                Set oNote = .Paragraphs(1).Range
                oNote.End = oNote.End - 1
                sNote = oNote.Text
                Set oNote = .Paragraphs(2).Range
                oNote.End = oNote.End - 1
                sNote = sNote & " - " & oNote.Text
                .Text = ""
                .Start = .Start - 1
                .Collapse 1
                .Footnotes.Add oRng, , sNote
                .Start = .Start + 1
                .End = ActiveDocument.Range.End
            End With
        Loop
    End With
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote