Solved

HMTL Frame Load Status Check

Posted on 2013-06-15
4
815 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

778 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