Note: Second try at replying, there is something wrong either with the
Microsoft News Server or my computer...
Hi Nic,
Maybe you should have posted this in the Word.VBA.General group...
In any case...
Have you looked at the VBA help available with Word? Do ALT-F11 to access
the VBE window, then F2 to get to the Object browser, then type "Bookmark"
in the search field... and here is an example straight from the help topic
"Bookmark, Property":
If ActiveDocument.Bookmarks.Count >= 1 Then
ReDim aMarks(ActiveDocument.Bookmarks.Count - 1)
i = 0
For Each aBookmark In ActiveDocument.Bookmarks
aMarks(i) = aBookmark.Name
i = i + 1
Next aBookmark
End If
This will generate a variable that stores all the bookmark names. If you
sort the bookmarks first (see below) you can output a list that is either
alphabetical or by location in the document.
Altenatively, if you had typed "Sort" in the search field, you would have
eventually found a property called "DefaultSort" that has to do with
bookmarks, as in the following example:
ActiveDocument.Bookmarks.DefaultSorting = wdSortByLocation
'or wdSortByName
Dialogs(wdDialogInsertBookmark).Show
Finally, if you you want a full list, inlcuding a list of the hidden
bookmarks Word automatically genrates (when you create a Table of Contents
for example), use the "ShowHidden" property as in:
ActiveDocument.Bookmarks.ShowHidden = True
For Each aBookmark In ActiveDocument.Bookmarks
If Left(aBookmark.Name, 1) = "_" Then MsgBox aBookmark.Name
Next aBookmark
This works because all hidden bookmarks generated by Word on the fly start
with an underscore character.
HTH
Cheers!