M
michael.blaustein
I am manipulating an InternetExplorer object programmatically with the
following code:
I then wait for the page to be ready before taking any action on it
with this block:
This works great. I can then go and play with all the following
objects:
This code then grants me access to the Frames in the page:
I then go through the objects in MyWindow, find a link, and use the
click method on it. So far, so good.
Here is the problem:
Clicking on that link in the "leftframe" changes the
"rightframe". I can't run the rest of the code until that
"rightframe" is ready. I have found no way to wait for the
"rightframe" to be ready, as the code I used above for the IE
object says it is ready, when it is not. I have read there is an event
called DocumentComplete for an InternetExplorer.Document object, but I
can't seem to be able to write the code to wait for the event. Am I
missing something? Thanks for reading this far.
Michael
following code:
Code:
Dim IE As InternetExplorer
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate (URL)
with this block:
Code:
While IE.Busy
DoEvents
Wend
Do
DoEvents
Loop Until IE.ReadyState = READYSTATE_COMPLETE
objects:
Code:
Dim oDoc1 As MSHTML.HTMLDocument 'for Document objects
Dim oWin1, oWin2 As MSHTML.IHTMLWindow2 'for Window objects
Dim oFrameC1 As MSHTML.FramesCollection 'for FrameCollection
objects
Code:
Set oDoc1 = IE.Document 'Get the document
Set oWin1 = oDoc1.parentWindow 'Get the Window for the document
Set oFrameC1 = oWin1.frames 'Get the FrameCollection
Set MyWindow = oFrameC1.Item("leftframe")
click method on it. So far, so good.
Here is the problem:
Clicking on that link in the "leftframe" changes the
"rightframe". I can't run the rest of the code until that
"rightframe" is ready. I have found no way to wait for the
"rightframe" to be ready, as the code I used above for the IE
object says it is ready, when it is not. I have read there is an event
called DocumentComplete for an InternetExplorer.Document object, but I
can't seem to be able to write the code to wait for the event. Am I
missing something? Thanks for reading this far.
Michael