Get Adjacent Bookmarks (VSTO)

R

Robertro

Hi all,

Given a bookmark within a document what's the best way of locating bookmarks
that maybe adjacent. (i.e. they share their start and end repsectively with
mine). I've noticed that the range object bookmarks collection *may* include
them but this isn't true for bookmark that also contain paragraph line
breaks. Is there a function like gotonext/previous that works. (goto next
bookmark seems to be broken)

Rob.
 
R

Russ

Rob,
Try
With Application.Browser
.Target = wdBrowseBookmark
.Next
End With
Also there is the .inrange method test for ranges
If Selection.InRange(ActiveDocument.StoryRanges(wdFootnotesStory)) Then
MsgBox "Selection in footnotes"
End If
 
R

Russ

Rob,
Sorry, I assumed that there was a wdBrowseBookMark object, but there isn't
one by that name in the Object Browser.
Although, this should would in VBA.
ActiveDocument.GoTo(What:=wdGoToBookMark, Which:=wdGoToNext)

But the .inrange method can be used to see if your bookmark ranges overlap.
Rob,
Try
With Application.Browser
.Target = wdBrowseBookmark
No wdBrowseBookmark object, Sorry.
 

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