I have a macro that lists bookmark names at the end of the doc in alphabetical order of bookmark name. Very cool. However, I would like to change the list to so the first bookmark name by location in doc is listed first, and so on to last bm name. Also gives the number of bookmarks.
Also, I attached a word file with brief list of bookmark names.
Code:
Sub BMNames()
' Dim abookmark As Bookmark
Dim abookmark As Variant
Dim i As Integer
' Dim aMarks() As Integer
Dim aMarks() As Variant
Selection.EndKey Unit:=wdStory
Set abookmark = ActiveDocument.Bookmarks
If ActiveDocument.Bookmarks.Count >= 1 Then
ReDim aMarks(ActiveDocument.Bookmarks.Count - 1)
i = 0
For Each abookmark In ActiveDocument.Bookmarks
aMarks(i) = abookmark.Name
Selection.TypeText Text:=abookmark.Name
Selection.TypeParagraph
i = i + 1
Next abookmark
End If
MsgBox "The active document contains " & _
ActiveDocument.Bookmarks.Count & " bookmarks."
End Sub