Link to home
Start Free TrialLog in
Avatar of Kds4evr
Kds4evr

asked on

HMTL Frame Load Status Check

Hey Experts,

I have searched high an low to no avail. Perhaps someone can come up a better soltuion than what I have?

I am accessing a webpage to run a parse of some data for reporting. Everything works great including the .ReadyState and .Busy up to this point. When I click to run the report in the browser (line 2) the page opens my report with the data I need in Frame(0). The issue is that is passes the .Busy status but Frame(0) is not loaded. When I debug I confirm this with a status of "loading".

I tried Do while .document.frames(0).Document.ReadyState <> "completed": Doevents: Loop by iteself and it gives me a runtime error 70 "Access Denied". For some reason the Sleep function gives it just enough time to work.

However, I am not comfortable using the Sleep function since it can be affeted by the network speed of the user. Any ideas on how I can actually check the true state of the Frame to ensure it is completed before setting the Table object?

With oIE
       .Document.Forms("WizForm5").Item("ViewReport").Click
            Do While .Busy: DoEvents: Loop: 
            Do While .Document.frames(0).Document.ReadyState <> "complete": Sleep 500: Loop
       Set Table = .Document.frames(0).Document.Body.parentElement.getElementsByTagName("TABLE")
        For Each Row In Table(12).Rows

Open in new window

Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

If you put content in a frame that is not server from the same server as the primary then you get a security violation because you are not allowed to script cross-domain or reference the document object cross-domain.

The solution is to get rid of the frame and bring content directly into the document using ajax.

Cd&
Avatar of Kds4evr
Kds4evr

ASKER

Hey Cd,

Thanks for the response. I admittedly do not know anything about ajax or its controls from VBA (if even possible). Anywhere you can suggest where maybe I can get some examples or tutorials on this? I searched through google, but most of the results are vb.net based, not VBA.

Dave
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kds4evr

ASKER

I was able to take what Cd had suggested and create an xmlHTTML sweep of the web server. Similar approach to aJAX. Works much quicker and without the interface!