Results 1 to 20 of 25

Thread: Activedocument.Footnotes.Reference.Text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,899
    Location
    Not sure if it means anything, but I think the box that is being displayed ...

    MsgBox ActiveDocument.Footnotes.Item(1).Reference.Text
    ... is part of the internal Word document structure. It might the the 'marker' for a Foot note (ASCII 2 I think)

    I did a little test. Put 3 footnotes in a doc (lower case roman numeals), and looped thru them

    #1 - was .Index 1
    #2 - was .Index 2
    #3 - was .Index 3

    Then I added a new footnote before #1, and they renumbered 1-4 as expected

    Looped through again

    New one - was .Index 1
    #1 - was .Index 2
    #2 - was .Index 3
    #3 - was .Index 4


    I think you're right --MS made it pretty hard to retreive the footnote number. I guess it's because it has to calculate them on the fly

    Hopefully some much more experienced person has something better, because the only thing I can up with is UGLY

    Option Explicit
    Sub ListFootnotes()
    Dim iNumber As Long
    Dim oFootnote As Footnote
    For Each oFootnote In ActiveDocument.Footnotes
       With oFootnote
          iNumber = .Range.FootnoteOptions.StartingNumber + .Index - 1
          Select Case .Range.FootnoteOptions.NumberStyle
             'only format I did
             Case wdNoteNumberStyleLowercaseRoman
             'brute force
             Select Case iNumber
                Case 1
                   MsgBox .Index & " -- " & .Range.Text & " -- " & "I"
                Case 2
                   MsgBox .Index & " -- " & .Range.Text & " -- " & "ii"
                Case 3
                   MsgBox .Index & " -- " & .Range.Text & " -- " & "iii"
                Case 4
                   MsgBox .Index & " -- " & .Range.Text & " -- " & "iv"
                Case 5
                   MsgBox .Index & " -- " & .Range.Text & " -- " & "v"
             End Select
             Case wdNoteNumberStyleUppercaseRoman
             Case wdNoteNumberStyleUppercaseLetter
             Case wdNoteNumberStyleSymbol
             Case wdNoteNumberStyleLowercaseLetter
             Case wdNoteNumberStyleArabic
          End Select
       End With
    Next
    End Sub


    Lots and lots of luck

    Paul
    Last edited by Aussiebear; 04-07-2023 at 01:43 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •