> >WITH THIS > >* (some set up code before this - including getting actve doc) > >* next, check that the bookmark exists in the bookmarks collection > >STORE loDocument.Bookmarks.Exists(tcBookmarkName) TO llBookmarkFound > >* [NOTE: this passes, the bookmark exists] > >* if bookmark not found, set errornum and return >IF NOT llBookmarkFound > STORE -32 TO .inErrorNum > RETURN .F. >ENDIF > >* otherwise, we should be able to go to it but wrap in error trap anyhow > >* set the range we want to "Go To" in >loDocRange = .ioActivedocument.Range() > >TRY > * [NOTE: next line fails and goes to the "CATCH". Outside of the > * TRY/CATCH, it returns "Bookmark not found" > > loDocRange.GoTo(wdGoToBookmark,wdGoToFirst,1,tcBookmarkName) > STORE .T. TO llReturn > >CATCH > STORE -33 TO .inErrorNum > STORE .F. TO llReturn >ENDTRY > >ENDWITH && for WITH THIS > >RETURN llReturn > >Hi,
tcBookmarkID=oword.Activedocument.Range.Bookmarks(tcBookmarkName).Range.BookmarkID ...Range.GoTo(wdGoToBookmark,wdGoToFirst,1,tcBookmarkID)You may use Selection object instead of Range; there bookmark names accepted:
oWord.Selection.GoTo(wdGoToBookmark,,,tcBookmarkName)Good Luck