0
votes

I am trying to cycle through the bookmarks in a word document by their location.

yes I have seen this: How to get list of all bookmark-elements from a Word document to an array in order by location: VBA / Word

no it didn't work. and for the life of me I am not sure why this doesn't since it is lifted from a MS support page.

Sub cycleBookmarks()
 ActiveDocument.Bookmarks.DefaultSorting = wdSortByLocation
 Dim bkm As Bookmark
  For Each bkm In ActiveDocument.Bookmarks
  Next bkm
End Sub

Anybody know how to properly cycle through bookmarks by document location? I don't care about headers and footers (though a complete answer would be nice)

1

1 Answers

2
votes

According to this MSDN site DefaultSorting property:

Returns or sets the sorting option for bookmark names displayed in the Bookmark dialog box (Insert menu). Read/write WdBookmarkSortBy.

Therefore you need to use @Mana solution from the link you provided in your question.