Hello Rolf,
Rolf Schumacher wrote (10-11-2007 19:41)
However, I was not able to record the setting or jumping to a bookmark
in a macro.
These might help:
(Mind: Bookmark names are case sensitive!)
Sub AddMyBookmark(sName$)
Dim oBookMark, oBookMarks, oBookMarkNw, oCursor
oBookMarks = thisComponent.getBookmarks()
' make sure that a possible exsiting sName is deleted
' otherwise we will end up with sName1
If oBookmarks.hasByName(sName) Then
oBookMark = oBookmarks.getByName(sName)
oBookMark.dispose
End If
oBookMarkNw = thisComponent.createInstance("com.sun.star.text.Bookmark")
oBookMarkNw.setName (sName)
oCursor = ThisComponent.getCurrentController.getViewCursor()
thisComponent.Text.insertTextContent(oCursor, oBookMarkNw, False)
End Sub
Sub GoToMyBookmark(sName$)
Dim oViewCursor, oBookMark, oBookMarks
oViewCursor = ThisComponent.getCurrentController.getViewCursor()
oBookMarks = thisComponent.getBookmarks()
If oBookmarks.hasByName(sName) Then
oBookMark = oBookmarks.getByName(sName)
oViewCursor.gotoRange (oBookmark.getAnchor.getStart(), FALSE)
End If
End Sub
--
Cor Nouws
Arnhem - Netherlands
nl.OpenOffice.org - marketing contact
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]