Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HMTL Frame Load Status Check

Posted on 2013-06-15
4
Medium Priority
?
847 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 1500 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
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 …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

963 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