Bookmark Selection Question

M

Magic Man

I have nested bookmarks in a document (for example [xxxxx[yyyyyy]xxxxx]).

Is it possible using Word VBA to identify if the cursor is in the "yyyyy"
bookmark instead of the "xxxxx" bookmark? When I use
"Selection.Bookmarks(1).Select", I always get the larger of the two bookmarks
returned.

Many thanks.
 
M

macropod

Hi Magic Man,

Try something like:
Sub GetBookmarkNames()
Dim Bkmrk As Bookmark
For Each Bkmrk In Selection.Bookmarks
MsgBox Bkmrk.Name
Next
End Sub

Cheers
 
H

Helmut Weber

Hi Magic Man,

try this one:

With Selection.Bookmarks
MsgBox .Item(.Count).Name
.Item(.Count).Select
End With

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top