Closed Thread
Results 1 to 5 of 5

HTML scraping using VBA

  1. #1
    Registered User
    Join Date
    01-03-2009
    Location
    Chicago,IL
    MS-Off Ver
    Excel 2007
    Posts
    11

    HTML scraping using VBA

    How can I using VBA do HTML scraping?

    A site which I have to use to update some data on a spreadsheet does not offer any web services. I have to copy data from the spreadsheet one cell at a time, paste into the search field and look at the results and decide what kind of modification is needed for that piece of data.

    If VBA can do HTML scraping here is what I thought I could do.
    For each of the data in the cell, I need to go to a search field on a website, manually enter the values and hit search. Then the browser generates a url like "http://www.mysite.com/search?hl=en&q=SNX018923" and returns the result as an HTML page. How can I use vba so that I can automate this process of generating the url and load the returned html text into a variable. Then I can use the script to search for a pattern of text and do something to the active cell from where the data was taken.

    *nix has a curl command. What is the equivalent of curl in VBA? How do I use it to get the result I am trying to acheive?

  2. #2
    Registered User
    Join Date
    01-03-2009
    Location
    Chicago,IL
    MS-Off Ver
    Excel 2007
    Posts
    11
    Got the solution.
    So the moderater may delete this post.

    Record a macro while running a webquery on the test link at the website and I have a set of vba code to start with.

    Am just amazed by what I could do with excel in such a short time with what my *nix colleagues used to show off with perl, grep, awk and such unix commands...

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning MacroLide

    We'll leave this post exactly where it is so that it may help anyone else with a similar query.

    Thanks for sharing your solution with us.

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    03-17-2012
    Location
    Mississauga,Ontario
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    75

    Re: HTML scraping using VBA

    can someone provide the code for this as mentioned above?

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: HTML scraping using VBA

    Lisa4Legin,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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