die funktion sucht das als string übergebene bookmark, und wenn diese existiert springt der cursor an die stelle des bookmarks.
zum Testen das macro ErrorTest aufrufen. (eine Datei mit eingebetteter Tabelle habe ich angehängt).
Code: Alles auswählen
function SelectionJumpToBookmark(Bookmark as string) as boolean
dim cnt as long
dim bm as string
dim oBookmark as object
cnt=ThisComponent.Bookmarks.count
do
cnt=cnt-1
bm=ThisComponent.Bookmarks.ElementNames(cnt)
loop until (cnt=0) or (bm=Bookmark)
if (bm=Bookmark) then
oBookmark=ThisComponent.Bookmarks.getByName(Bookmark).Anchor
was mache ich falsch?
ThisComponent.CurrentController.getviewCursor().gotorange(oBookmark, False)
SelectionJumpToBookmark=true
else
SelectionJumpToBookmark=false
endif
end function
sub ErrorTest
SelectionJumpToBookmark("Ende")
end sub
ThisComponent.CurrentController.getviewCursor().gotorange(oBookmark, False)
was muss ich tun damit das springen zum bookmark trotz makierten objekt funktioniet!