View Single Post
 
Old 01-04-2023, 05:17 PM
Wigi Wigi is offline Windows 10 Office 2019
Novice
 
Join Date: Jun 2019
Posts: 7
Wigi is on a distinguished road
Default Get only endnotes of selected text

Hello all,

I would like to programmatically loop through the endnotes that are part of the selected text in a Word document.

I can do that, but the code gives me ALL endnotes in the document. It seems to ignore the fact that I only want the endnotes from what text is selected (text contains the superscript index numbers).

Can anyone help please ? Thanks a lot !

In the screenshot, I selected 2 lines of text, still I get all my 327 endnotes of the active document. I would expect only a couple of endnotes in the Immediate window.

HTML Code:
Sub forum()

    Dim e                     As Endnote

    For Each e In Selection.Range.Endnotes
        Debug.Print e.Index
    Next

End Sub
Attached Images
File Type: png endnotes.PNG (5.3 KB, 10 views)
Reply With Quote