Solved

HMTL Frame Load Status Check

Posted on 2013-06-15
4
813 Views
Last Modified: 2013-07-01
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

0
Comment
Question by:Kds4evr
  • 2
  • 2
4 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39251406
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&
0
 

Author Comment

by:Kds4evr
ID: 39251436
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
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 39251904
Ajax is just a reference to to common javascript libraries to use xmlhttp.  for vba I yhink you should be able to use Msxml2.XMLHTTP.3.0 as an activeX object.

This msdn page might help you:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms753800%28v=vs.85%29.aspx 

The xmlhttp object is basically a means of using the http protocol to go to the server without reloading the page and returning the data and then putting it out in the page either but just dropping the whole response in to a container, or parsing the document nodes for custom formatting.

I'm not surprised to see very little for vba; because it is pretty rare to see vba being used with a web page these days.

Cd&
0
 

Author Closing Comment

by:Kds4evr
ID: 39292195
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!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now