• Getting Footnote Reference (Word 2000+)

    • This topic has 12 replies, 3 voices, and was last updated 21 years ago.
    Author
    Topic
    #404880

    Hi all,

    Anyone know how to get a footnote reference using VBA?
    The

    Reference.Text 

    property of the Footnote object returns a non-printing character of ASCII value 2. I’d like the actual number/letter that shows up in the document. I also tried a roundabout way, trying to get it from the footnote text itself, but it doesn’t show up there either.

    Any help would be greatly appreciated.

    Thanks!

    Viewing 1 reply thread
    Author
    Replies
    • #826964

      Try this

      Sub temp2()
        Dim aFt As Footnote
        For Each aFt In ActiveDocument.Footnotes
          Debug.Print aFt.Index & ": " & aFt.Range
        Next aFt
      End Sub
      • #826966

        Hi Andrew,

        Yeah, I’d tried using the Index property, but it doesn’t account for letters or roman numerals used as references, or for restarting over sections.

        • #827212

          Hi Andrew,

          I fear you have to figure it out from the FootnoteOptions (.NumberStyle, .StartingNumber), and the footnote index.

          frown Klaus

        • #827213

          Hi Andrew,

          I fear you have to figure it out from the FootnoteOptions (.NumberStyle, .StartingNumber), and the footnote index.

          frown Klaus

        • #828032

          Ahh… Can you harvest the contents of the text which uses the style Footnote Reference?

          What is the purpose for this task?

          • #828052

            Hi Andrew,

            Just tried that, but I keep getting that non-printing character (ASCII value 2). brickwall

            I was trying to write a macro that would generate a 2-column table of footnotes, with the paragraph containing the reference (and including the reference) in one column, and the footnote text in the other.

            Thanks for your help!

            • #828132

              This problem appears to be harder to solve than it should be.

              A fallback method may be to search the paragraph text for the bit that uses the ‘Footnote Reference’ character style. This will be complicated by multiple footnotes in one paragraph so it is certainly less than ideal but since you are already working with that paragraph perhaps you could go that way.

              But then again, you don’t actually need the footnote reference separated out in the table as described that you are constructing. Have you tried browsing by footnotes which moves the cursor in front of the reference and then selecting the following word?

            • #828133

              This problem appears to be harder to solve than it should be.

              A fallback method may be to search the paragraph text for the bit that uses the ‘Footnote Reference’ character style. This will be complicated by multiple footnotes in one paragraph so it is certainly less than ideal but since you are already working with that paragraph perhaps you could go that way.

              But then again, you don’t actually need the footnote reference separated out in the table as described that you are constructing. Have you tried browsing by footnotes which moves the cursor in front of the reference and then selecting the following word?

          • #828053

            Hi Andrew,

            Just tried that, but I keep getting that non-printing character (ASCII value 2). brickwall

            I was trying to write a macro that would generate a 2-column table of footnotes, with the paragraph containing the reference (and including the reference) in one column, and the footnote text in the other.

            Thanks for your help!

        • #828033

          Ahh… Can you harvest the contents of the text which uses the style Footnote Reference?

          What is the purpose for this task?

      • #826967

        Hi Andrew,

        Yeah, I’d tried using the Index property, but it doesn’t account for letters or roman numerals used as references, or for restarting over sections.

    • #826965

      Try this

      Sub temp2()
        Dim aFt As Footnote
        For Each aFt In ActiveDocument.Footnotes
          Debug.Print aFt.Index & ": " & aFt.Range
        Next aFt
      End Sub
    Viewing 1 reply thread
    Reply To: Getting Footnote Reference (Word 2000+)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: