Hi Adolf,
I do not know what you are trying to achieve, but since you know that
BookmarkID is a range or selection property, why don't you define a range
first, and then find the bookmark you want in that range? Other than that, I
am confused by you explanations... You write that since you do not know the
bookmark name or collection index number, you cannot select it, which is
true. So, how does the BookmarkID helps you then? The BookmarkID property
always return the bookmark ordinal (numbered) position in the document,
regardless of the range you define. So a bookmark maybe the first in your
range, but fourth overall in the document, so BookamrkID will return 4.
In any case, if this gives you any ideas, here is some code I quickly put
together:
_______________________________________
Sub Play_With_Bookmark()
Dim MyRange As Range
Dim MyBookmark As Bookmark
Set MyRange = ActiveDocument.Range
If Not MyRange.Bookmarks.Count = 0 Then
MsgBox "There are " & MyRange.Bookmarks.Count & _
" bookmarks in your range."
Else
MsgBox "There are no bookmarks in your range."
End If
For Each MyBookmark In MyRange.Bookmarks
MyBookmark.Select
If Selection.BookmarkID = 1 Then
MsgBox "Bookmark " & Selection.BookmarkID
Else
MsgBox "This is not the first " _
& "bookmark in the document."
End If
Next MyBookmark
End Sub
_______________________________________
HTH
Cheers!