none
footnote numbers RRS feed

  • Question

  • This statement

        footnote_number = Selection.Footnotes(1).Index

    gets the index within the document of footnote that has the current selection.

    New chapters generally restart footnote numbering at 1. What statement would return the published footnote number (relative to the chapter)?


    Dave


    David K. Ream

    Monday, June 13, 2016 9:00 PM

Answers

  • To get the index number of a footnote in a Section (chapter in your parlance), relative to the Section, you could use code like:

    Sub Demo()
    With Selection
      If .Information(wdInFootnote) = True Then
        With .Footnotes(1)
          MsgBox ActiveDocument.Range(.Reference.Sections(1).Range.Start, .Reference.End).Footnotes.Count
        End With
      End If
    End With
    End Sub

    The only way I've found for retrieving the actual footnote number in VBA (which you might want to do if not using digits) is by inserting a cross-reference to the footnote and reading that. The same applies to endnotes.

     

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Monday, June 13, 2016 10:45 PM

All replies

  • To get the index number of a footnote in a Section (chapter in your parlance), relative to the Section, you could use code like:

    Sub Demo()
    With Selection
      If .Information(wdInFootnote) = True Then
        With .Footnotes(1)
          MsgBox ActiveDocument.Range(.Reference.Sections(1).Range.Start, .Reference.End).Footnotes.Count
        End With
      End If
    End With
    End Sub

    The only way I've found for retrieving the actual footnote number in VBA (which you might want to do if not using digits) is by inserting a cross-reference to the footnote and reading that. The same applies to endnotes.

     

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Monday, June 13, 2016 10:45 PM
  • perfect! thanx.

    David K. Ream

    Monday, June 20, 2016 4:10 PM
  • Hi Dave,

    If your issue has been resolved, I would suggest you mark the helpful reply as answer, and then others who run into the same issue would find the solution easily.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, June 21, 2016 3:04 AM