Hi Vincent
In VBA you can use something like this:
Dim oDoc As Word.Document
Dim bm As Word.Bookmark
Set oDoc = Word.ActiveDocument
For Each bm In oDoc.Bookmarks
Debug.Print bm.Name
Next bm
I'll leave you to translate to C#.
You might like to know that Word accumulates hidden bookmarks as it goes
about its work. And a user or developer might have created a hidden
bookmark. You can see them at Insert > Bookmark, by ticking the hidden
bookmarks box.
If you only want to show the unhidden bookmarks, try something like this:
Dim oDoc As Word.Document
Dim bm As Word.Bookmark
Dim bWasHiddenBookmarks as Boolean
Set oDoc = ActiveDocument
bWasHiddenBookmarks = oDoc.Bookmarks.ShowHidden
oDoc.Bookmarks.ShowHidden = False
For Each bm In oDoc.Bookmarks
Debug.Print bm.Name
Next bm
oDoc.Bookmarks.ShowHidden = bWasHiddenBookmarks
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word