Am 20.08.2010 09:51, schrieb Thomas Krumbein:
Hi,
I do have some macros, which will start on events (for example "document
close") or with user-action (menu-button).
Those macros presents dialogs and the user can do some inputs and so on.
Now it is possibel, to start the marco several times (i.e. close two
documents in a very short time, click twice on a start-Button, if the
dialog-Window is only "visible", not started with "execute").
Now I am looking for a possibility to check first, if the macro is still
running - and do then an "exit sub".
My first intent was, to check, if the dialog-window is still open and
identify this frame using the frames-title.
so I create an enumeration
oComp = stardesktop.getComponents.createEnumeration
but I only get the main components - so i.e. the writer-frame.
So, how can I identify my dialog-frames or is there another possibility
to identify, if my marco is still running?
My first idea is a kind of a mutex, though it's not a high-end solution...
Dim running As Boolean ' global variable initializes to 0 -> false
Sub MyMacro
If running Then Exit Sub
running = True
On Error Goto errorhandler
...
...
running = False
Exit Sub
errorhandler:
MsgBox "Error!"
running = False
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]