Class Endnote (Word VBA)
The class Endnote represents an endnote. The Endnote object is a member of the Endnotes collection, which represents the endnotes in a selection, range, or document. To use a Endnote class variable it first needs to be instantiated, for example
Dim end as Endnote
Set end = ActiveDocument.Range.Endnotes(Index:=1)
For Each
Here is an example of processing the Endnote items in a collection.
Dim end As Endnote
For Each end In ActiveDocument.Range.Endnotes
Next end
Delete
Deletes the specified endnote.
ActiveDocument.Range.Endnotes(1).Delete
Index
Returns a Long that represents the position of an item in a collection.
Dim lngIndex As Long
lngIndex = ActiveDocument.Range.Endnotes(1).Index
Range
Returns a Range object that represents the portion of a document that is contained in the specified object.
For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method.
With ActiveDocument.Endnotes(1).Range
.Delete
.Text = "new endnote text"
End With
Reference
Returns a Range object that represents an endnote reference mark.
Set myRange = ActiveDocument.Endnotes(1).Reference
myRange.Copy