Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

wdGoToNext and moving between bookmarks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wespa - 17 Nov 2004 20:39 GMT
Hi.
Why dont this code work.
ActiveDocument.GoTo what:=wdGoToBookmark which:=wdGoToNext

Is it possible to jump between bokmarks without knowing ther name ?
Helmut Weber - 17 Nov 2004 22:14 GMT
Hi Wespa,
I don't know why. Like so many things things,
it should work, but doesn't.
Here comes a workaround:
Sub Test445()
' next bookmark
On Error GoTo finish
Dim r As Range
Selection.Collapse direction:=wdCollapseEnd
Set r = Selection.Range
If r.start = r.End Then
  r.start = r.start + 1
End If
r.End = ActiveDocument.Range.End
r.Bookmarks(1).Select
Exit Sub
finish:
MsgBox "no more bookmarks"
End Sub
' ---
Sub Test446()
' previous bookmark
On Error GoTo finish
Dim r As Range
Selection.Collapse direction:=wdCollapseStart
Set r = Selection.Range
r.start = 0
r.Bookmarks(r.Bookmarks.Count).Select
Exit Sub
finish:
MsgBox "no more bookmarks"
End Sub
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Klaus Linke - 18 Nov 2004 01:26 GMT
Hi Helmut, Wespa,

I fought with this too. If you have overlapping bookmarks, it gets terribly
messy (if you don't want to miss some bookmarks, or risk ending up in a
loop).
I guess the Word programmers ran into the same problem, and gave up.

Regards,
Klaus
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.