W
Walter Briscoe
I am running Excel 2003, IE7, and XP SP3
(I have learnt how to get information from IE from examples posted by
Joel <[email protected]>.)
Excel VBA interacts with IE with IE.visible = False as the user does not
need to see that interaction.
The windows start bar sometimes shows briefly during such interaction.
More briefly, the IE window outline appears.
What mechanisms cause such transient behavior?
How can I code to achieve consistent behavior?
n.b. IE.visible = True is not acceptable!
Most of the time the interaction is automatic. When user intervention is
necessary, I use IE.visible = True to allow that intervention and an
Excel VBA MsgBox call to allow my code to wait until the user signals
the intervention is complete. I tried putting a doevents call in the
middle to see if I could get the behavior I want which is for the MsgBox
to be visible and for the focus to be on IE. (Excel is full screen and
IE is in a 500 pixel wide window.)
So far I have seen two scenarios:
1) IE has the focus and Excel flashes to show the user needs to act.
When I give Excel focus, the MsgBox appears;
2) Excel retains focus, the MsgBox appears and IE flahes for attention.
This is a fairly obvious race condition.
What can I do to avoid that race condition?
I say again, My code is:
' IE.busy is false
IE.visible = True ' Unhide IE window
doevents ' Give control to IE etc.
MsgBox "Do something with IE!" ' Let the user say IE is ready again
IE.visible = False ' Hide IE window
My understanding of Excel/IE interaction is still naive.
I would value suggestions on good (ideally free) places to read.
(I have learnt how to get information from IE from examples posted by
Joel <[email protected]>.)
Excel VBA interacts with IE with IE.visible = False as the user does not
need to see that interaction.
The windows start bar sometimes shows briefly during such interaction.
More briefly, the IE window outline appears.
What mechanisms cause such transient behavior?
How can I code to achieve consistent behavior?
n.b. IE.visible = True is not acceptable!
Most of the time the interaction is automatic. When user intervention is
necessary, I use IE.visible = True to allow that intervention and an
Excel VBA MsgBox call to allow my code to wait until the user signals
the intervention is complete. I tried putting a doevents call in the
middle to see if I could get the behavior I want which is for the MsgBox
to be visible and for the focus to be on IE. (Excel is full screen and
IE is in a 500 pixel wide window.)
So far I have seen two scenarios:
1) IE has the focus and Excel flashes to show the user needs to act.
When I give Excel focus, the MsgBox appears;
2) Excel retains focus, the MsgBox appears and IE flahes for attention.
This is a fairly obvious race condition.
What can I do to avoid that race condition?
I say again, My code is:
' IE.busy is false
IE.visible = True ' Unhide IE window
doevents ' Give control to IE etc.
MsgBox "Do something with IE!" ' Let the user say IE is ready again
IE.visible = False ' Hide IE window
My understanding of Excel/IE interaction is still naive.
I would value suggestions on good (ideally free) places to read.