+ Reply to Thread
Results 1 to 6 of 6

Pulling data from Internet Explorer in newly opened window

  1. #1
    Registered User
    Join Date
    08-18-2005
    Posts
    59

    Pulling data from Internet Explorer in newly opened window

    Everyone,

    I've run into a snag. I have a project where I want to pull data automatically from a web page that requires a log on. After the log on, I can navigate to the query form page, but once I submit that form, the results are displayed in a newly popped open window in internet explorer. Below is a simplified version of what I've got so far. See my comments in the code towards the end to understand where I'm falling down on this. Any tips/tricks/sample code to get me over this hurdle would be greatly appreciated. This problem has blocked me on prior projects as well that I could wrap up if I only knew how to get around it.

    Thanks in advance...

    Please Login or Register  to view this content.
    Excel_Geek
    http://blog.excelgeek.com/

    "...I'll do that in Excel for $50..."

  2. #2
    Forum Contributor
    Join Date
    07-13-2007
    Posts
    151

    Getting Data from the Second Page

    After reading your code, one idea I would have is to find the URL that the submit button you're clicking is going to. Read the HTML to find this. I've found that the Element Inspector provided with Google Chrome is excellent for this task. Then see if you can just create that URL yourself in the code and use .navigate with your current IE object to go to that page.

    Then you can set your htmlcoll to that document and off you go.

    Depending on the consistency of the URL, you may be able to do it right after you get the page after your log in without having to do the other loops. Might be faster.

  3. #3
    Registered User
    Join Date
    08-18-2005
    Posts
    59

    Pulling data from Internet Explorer in newly opened window

    Thanks for the suggestion, but it wasn't quite so easy. The "submit button" doesn't link directly to another URL -- rather it launches some javascript that does the rest. Otherwise, I'd probably have just been using a "post" method to do this. Any other thoughts?

  4. #4
    Forum Contributor
    Join Date
    07-13-2007
    Posts
    151
    Javascript, bummer. I've had problems with that too.

    I recall one time being able to trap the interim URL that the Javascript launched. I'm assuming that your resulting window has a URL that is useless to you. That is if you try to launch it separately, it doesn't work for you.

    I was able to trap the interim URL that flashes through the browser briefly by monitoring the LocationURL property of the IE object, and then used that URL in my code to circumvent the javascript.

    Don't know if it'll work in your situation, but might be worth a try.

    Does the IHTMLDocument2 property give you access to the document in the second popped-up browser window?

  5. #5
    Forum Contributor
    Join Date
    07-13-2007
    Posts
    151

    A way to get to that second window

    Excel_Geek:

    I've been wondering about this problem and found a post in another context that I've adapted to this problem.

    Below is a way to cycle through each open window. While doing that loop, you can test for anything, in this context, I've tested for the New URL that you might know your new window would have(??), and when found, grab that window's document. Once you've got that, you could continue on with whatever it is you need to do with that window's document.

    Might work in your problem?

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-18-2005
    Posts
    59

    Pulling data from Internet Explorer in newly opened window

    ShredDude,

    Excellent work. That little snippet, with few tweaks to embed it in my code will work just find. Shell commands! Why didn't I think of that?

    Many thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opening a webpage with VBA
    By wilro85 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2008, 07:58 PM
  2. How can I speed up this slow macro?
    By rs2k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2008, 08:34 PM
  3. open Window explorer from Excel
    By Chris Baluyot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2008, 11:25 PM
  4. import the internet data
    By shreyans in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2008, 09:49 AM
  5. Opening Excel in Internet Explorer
    By ace333 in forum Excel General
    Replies: 3
    Last Post: 05-08-2007, 08:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1