+ Reply to Thread
Results 1 to 8 of 8

Excel vba web scrape

  1. #1
    Registered User
    Join Date
    03-09-2016
    Location
    Rotterdam
    MS-Off Ver
    2016
    Posts
    28

    Excel vba web scrape

    Hi all,

    I try to automate a boring task in Excel using a script that should do the following:
    1. go to web page
    2. click on a image button

    By clicking the button on the web page, it trigger a download of an excel file.

    the script that I have so far:
    Please Login or Register  to view this content.
    Problem:
    I get an automation error at
    Set elements = objIE.document.getElementsByTagName("img")

    I have checked Microsoft shell controls, internet controls, OLE, html object library as references.

    Any ideas what I should do to fix the problem?

    IE 11
    Windows 10
    64 bit
    excel 64 bit

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi,

    you must wait the webpage has finished to load before trying to get any element
    or your procedure obviously fails as the element does not yet exist in the webpage …

  3. #3
    Registered User
    Join Date
    03-09-2016
    Location
    Rotterdam
    MS-Off Ver
    2016
    Posts
    28

    Re: Excel vba web scrape

    Thank you for taking the time to respond to my question.
    I adjusted the code to
    Please Login or Register  to view this content.
    The web page now remains blank. That suggest that get elements is wrong right?
    Last edited by prinsr; 11-18-2019 at 07:32 AM.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    As the element does not exist in the webpage ! …

    As we are not on a mind readers forum (so I won't try to guess anything)
    just see the many samples within this forum (or any other on on blogs whatever),
    see in particular the ReadyState property.

    Check if the file to download has a direct URL so you do not ever need to pilot IE …

  5. #5
    Registered User
    Join Date
    03-09-2016
    Location
    Rotterdam
    MS-Off Ver
    2016
    Posts
    28

    Re: Excel vba web scrape

    Hi Marc L,

    I will try to be more specific:

    The HTML code is as follows:
    Please Login or Register  to view this content.

    The HTML script above is within the body

    There is no ID which would have made it easier for me. If you have any suggestion how i can refer to src it would help me a lot.
    Can I do something with the title?

    Thanks!

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,143

    Re: Excel vba web scrape

    No id, no input, no class, no name, no type ...

    Is this maybe some sort of test for solving puzzles, charades, crosswords ?
    Post a larger or large piece of HTML to see its structure, or a link to a page, unless it is a protected page or with confidential informations or "cia-o", "fbi-ao", "nsa-o", "mi5-ao", "fsb-ao" ... and similar weird-strange webpages ... ... then better not publish ... for our safety ...
    Maybe then someone will come up with something ... ... maybe ... it depends on how the webpage has been programmed.

  7. #7
    Registered User
    Join Date
    03-09-2016
    Location
    Rotterdam
    MS-Off Ver
    2016
    Posts
    28

    Re: Excel vba web scrape

    Quote Originally Posted by porucha vevrku View Post
    No id, no input, no class, no name, no type ...

    Is this maybe some sort of test for solving puzzles, charades, crosswords ?
    Post a larger or large piece of HTML to see its structure, or a link to a page, unless it is a protected page or with confidential informations or "cia-o", "fbi-ao", "nsa-o", "mi5-ao", "fsb-ao" ... and similar weird-strange webpages ... ... then better not publish ... for our safety ...
    Maybe then someone will come up with something ... ... maybe ... it depends on how the webpage has been programmed.
    hahah if it is too easy then you will not get challenged enough. Here is the rest of the code:

    Please Login or Register  to view this content.
    I left out the < and > due to server error.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Quote Originally Posted by prinsr View Post
    If you have any suggestion how i can refer to src it would help me a lot.
    In last ressource use its XPath you can see via your webbrowser inspector tool …

+ 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. How do I loop scrape a table that has the option for extraction into Excel?
    By excelhelpguy123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-20-2017, 06:04 AM
  2. Scrape Multiple Pages with Similar Format to Excel
    By brsawvel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2016, 09:57 PM
  3. Web Scrape To Excel VBA: JAVA Site
    By excel2425 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2016, 05:26 PM
  4. [SOLVED] Need VBA code to scrape data into excel from list of websites
    By nadair1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2014, 11:45 AM
  5. Scrape Data Using VBA From IE to Excel - Help with code
    By Galleon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2014, 11:00 AM
  6. Scrape, pull or get data from a Website into Excel Please help me out
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2014, 01:42 PM
  7. Having trouble with Excel web query for data scrape
    By stevenab87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2012, 10:18 PM

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