+ Reply to Thread
Results 1 to 14 of 14

Retrieve information from website using VBA

  1. #1
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Retrieve information from website using VBA

    If anyone could help me, it would be much appreciated. But I am looking to build a macro that will look up an item number that I type in excel, and do a search on a website like Amazon, or any other retailer, and return information from that search such an item price, specs, etc.

    I am not even 100% sure that this is possible, but I figured to ask if anyone had an idea.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Retrieve information from website using VBA

    Hello kwaldersen,

    There are several ways to present data on a website. So, there is no one method that will guarantee success in retrieving specific data from any webpage. If you know which sites you will scraping information from and the specific data you want then the answer would be yes.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Retrieve information from website using VBA

    Thanks Leith,

    Here is one of the examples of a site that I would use...

    www.lowes.com

    I would search an item number of an item, example " RTW4640YQ"

    In this case, an appliance pops up. I would want to bring in the price ($399 in this case)

    How would I write this?

  4. #4
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Is this what you are wanting to do?




    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Or try this one, much faster..


    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Retrieve information from website using VBA

    Thanks for the response.

    I think this is kind of on the right path, but what I am looking to do is have a column of about 10-15 item numbers, and when I run the macro, it will go retrieve the prices of those items from Lowes website.

  7. #7
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Like this?

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Oh wow! Sorry... I just realized, the site redirects unless you select your zipcode. That is why the price didnt show up and lord knows why or how i missed that. . . Let me try that again

  9. #9
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Retrieve information from website using VBA

    Is there a way to have the prices appear in the same file as the item numbers? So if i have a list of items in column C, then the prices would appear in column D?

  10. #10
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Im not sure how i would get around that redirect using that method. . This might work though, needs some cleaning but it should get the job done:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    Now that i have time to clean this up, take a look:

    Please Login or Register  to view this content.
    Last edited by downtown1933; 03-10-2013 at 02:36 AM.

  12. #12
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Retrieve information from website using VBA

    Thanks alot for your help.

    I am getting an error at the beginning of it though, at the "dim LOIE" part. It is saying "User defined type not defined".

  13. #13
    Registered User
    Join Date
    08-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Retrieve information from website using VBA

    Nevermind...I didnt have internet controls enabled. Fixed it.

    When I run it however, it is just pasting in all the text from page of the search result. Also, right now, it is set to only search that same item. If i had a list of 5 items, how would i edit the search?

    Ideally, what I would like the end result to be is to have a column that has 5 items, which could change, and when the macro is run, it will bring in the current prices that lowes as on their website, and have those prices displayed in the column next to the item numbers

  14. #14
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Retrieve information from website using VBA

    When you paste the code, you need to delete the part = "washer", and un-comment the application.inputbox line next to it. Should look like this: part = application.inputbox("What are we searching for at Lowes today? "Lowes Search",Type:=2)

    As for the text, it sounds like the function is not getting called. . Which is weird because i tested it before i posted. Let me look real quick..

+ 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