macro with if condition
I have an autoopen macro to go on a specif bookmark ("here") created whenever I save a writer document.
I wonder if it could be possible to disable this macro if the odt file is open from another odt file (and not from Dolphin, i.g.). So I could open the target file at the point I want (a bookmark different from "here").
Thanks
EDIT
@Lupp: 1) autoopen: I mean that macro runs automatically when a odt is opened
2) this is the macro (stored, so to say, not in a file, but in LibreOffice: affecting all odt files)
sub vai_qui
If ThisComponent.supportsService("com.sun.star.text.TextDocument") Then
oBookmarks = ThisComponent.getBookmarks()
If NOT oBookmarks.hasByName("qui") Then
Exit Sub
End If
ViewCursor = ThisComponent.CurrentController.getviewCursor()
Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor
ViewCursor.gotorange(Bookmark, False)
ViewCursor = ThisComponent.CurrentController.getviewCursor()
Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor
ViewCursor.gotorange(Bookmark, False)
else
Exit Sub
End If
end sub
3) I'd like add a code, if possible, to disable this macro (in the target-document) if the new document is open (not from a specific file, but) from inside LibreOffice (/LibreWriter) and not from "outside" (i.g. Dolphin). Thank you
The subject you chose seems misleading to me. Conditional statements in macros are surely well known.
In your case the question is how to branch in a macro called for an opening document anyway based on info about what/who had opened it.
I also don't know the term "autoopen macro" as something with a clear meaning.