
Signature
...but the beer is still good!
Hmmm. No reply yet. I would be interested in someone came up with something.
I am not sure it is possible. An open dialog has focus. You can not execute
anything until it loses that focus.
If you have any open dialog, and try to run any code at all, even right from
the VBE, you can't. The Application object is giving full focus to the
dialog.
I would be happy to hear that one could do what you are asking, but it may
not be possible.
Julian - 29 Nov 2007 23:57 GMT
I can't see what the original question was but reading between the lines...
and assuming this is Word VBA...
> Hmmm. No reply yet. I would be interested in someone came up with
> something.
[quoted text clipped - 6 lines]
> the VBE, you can't. The Application object is giving full focus to the
> dialog.
In principle IF the dialog is MODAL, not otherwise - but I regularly see
supposedly MODAL dialogs that have lost focus and can't easily be dismissed.
And OnTime code will run whenever it's supposed to except in Debug mode -
and the VBE will tell you that it has failed to run as soon as it tries.
To get rid of potentially lurking dialogs - if they are userforms, msgbox's,
inputs - enforce some form of titling convention and then iterate through
the Tasks collection and close the task on string matching - but beware:
unpredictable results may occur, but it's handy if you're stuck... you can
even do it across applications via the Tasks collection.