> I'm connecting to an application via GetObject. The problem is, if the
> application is busy doing something (like editing a cell in Excel), GetObject
> fires up a busy dialog (Switch To... or Retry). Is there a way to test if an
> application is running and if it busy before I attempt to connect to it via
> GetObject?
On Error Resume Next
Actually GetObject connects with Excel properly but when I try get the
active document, I receive the Component Busy dialog (Switch To..., Retry,
Cancel).
Set moActiveDoc = goHostApp.ActiveWorkbook
So, VB is not erroring out, it just stuck in a infinate loop (unless I go
Excel and Esc out of editing the cell). So, the question is, is there a way
to sense if the application object is busy or not before you request
something of it.
Thanks the help Ralph.
> > I'm connecting to an application via GetObject. The problem is, if the
> > application is busy doing something (like editing a cell in Excel),
[quoted text clipped - 21 lines]
>
> -ralph
Ralph - 22 Sep 2007 16:23 GMT
> On Error Resume Next
>
[quoted text clipped - 10 lines]
>
> Thanks the help Ralph.
But, again, ARE you using error-handling?
IIRC, this error is usually caught with error-handling, or perhaps there is
something else that needs to be configured. Have to go back and check some
of my stuff.
-ralph
MAB - 22 Sep 2007 16:52 GMT
I did not but the effect is eccentually the same if I do. Meaning, the error
handler is only triggered after the user presses the Cancel but which breaks
the loop otherwise it keeps trying forever (occationally timing out which
pops up the busy dialog).
On Error GoTo stuck
Set moActiveDoc = goHostApp.ActiveWorkbook
GoTo bypass
stuck:
MsgBox Err.Description
End
bypass:
On Error Resume Next
> > On Error Resume Next
> >
[quoted text clipped - 19 lines]
>
> -ralph
Ralph - 22 Sep 2007 19:49 GMT
> I did not but the effect is eccentually the same if I do. Meaning, the error
> handler is only triggered after the user presses the Cancel but which breaks
[quoted text clipped - 11 lines]
> bypass:
> On Error Resume Next
Is this a situation where both the App and the User are chewing on something
at the same time?
-ralph
MAB - 22 Sep 2007 20:04 GMT
Yes sir. The user has an Excel spread sheet open and is editing the cell.
The user leaves Excel in this state and launches my app which use GetObject
to connect to Excel (which successful) then attempts to connect to the active
document in Excel but it can't because the document is busy editing a cell.
> > I did not but the effect is eccentually the same if I do. Meaning, the
> error
[quoted text clipped - 18 lines]
>
> -ralph