Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

HMTL Frame Load Status Check

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php mysql check email already in database. (second check) 7 65
jQuery Sticky Menu 24 36
How to combine and minify CSS and JS files 5 17
VBScript on Html 15 47
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 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