+ Reply to Thread
Results 1 to 6 of 6

Macro to grab webpages

  1. #1
    Registered User
    Join Date
    03-17-2007
    Posts
    5

    Macro to grab webpages

    Hi,

    I am writing an Excel macro that goes to a series of URLs (on a company intranet application) and extracts data into Excel which I will then merge and reformat for subsequent upload into MS Access.

    The spanner in the works is knowing when the webpage has loaded.

    If the macro sends subsequent commands (usually SendKeys) to IE before the page has loaded the whole things falls over.

    The most reliable way I've found is simply to use

    Please Login or Register  to view this content.
    But since some of the web pages in question can take up to a minute to load (hell that's why I'm trying to automate download afterall....) that means putting whole minute waits all the way through the macro

    Other code I've tried is creating loops using Events in IE:

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    But those seem to work a bit sporadically.

    Has anyone else tackled this problem, or can think of better approaches I could try?
    Last edited by VBA Noob; 03-17-2007 at 04:12 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    I've had some success in using Excel to write scripts in a language called Ruby which is designed to work with web pages and then shelling the Ruby executable.

    The attachment used to work in driving EBay (before they changed the design of their site)
    Attached Files Attached Files
    Martin

  3. #3
    Registered User
    Join Date
    03-17-2007
    Posts
    5
    Nobody else?

    The ruby code seems to just use waits also.

  4. #4
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    I don't know if this is any help, but I've used
    Please Login or Register  to view this content.
    which is the same as combining your two loops.

  5. #5
    Registered User
    Join Date
    03-17-2007
    Posts
    5
    thanks, i'll try that

  6. #6
    Registered User
    Join Date
    03-17-2007
    Posts
    5
    T-J's trick seems to have worked, at least on my machine.

    But I still get the problem on some other computers (think huge company with lots of computers all supposedly to the same build standard,... strangely enough IT can't seem to build two the same )

    The problem comes when loading the webpage, I can see my Sendkey's going off early. Almost like the do while loop has no effect.

    But on other machines it works. Bearing in mind that I can't really change any settings on any of the machines, how can I tackle that prob?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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