+ Reply to Thread
Results 1 to 20 of 20

Getting data from multiple webpages and posting into one excel sheet

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Getting data from multiple webpages and posting into one excel sheet

    Hi,

    I'm working on several law firms. I have profiles of many lawyers and I need to copy their practice area from a part of a web page and transport it to Excel.
    The data is available at the same place on all the webpages, but the data obviously differs.
    I have a list of the hyperlinks in my Excel Worksheet.
    For example:

    http://www.babc.com/hal-albritton/
    http://www.babc.com/paul-a-alexis/

    What I need to do is copy the text under the Service Offered area in an Excel file alongside the hyperlink.

    Is there any Macro to achieve this?

    Also I have minimal-->no knowledge about macros/VBA/etc.

    If anyone can help me out that'll be absolutely fantastic! Thanks in advance!

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    Do you have ie9 or 10 installed?

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    I have IE9
    But I also have Firefox and Chrome

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    As a UDF:

    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    Please Login or Register  to view this content.
    You will need to set a reference to "Microsoft HTML Object Library" - in the VBA screen, go to Tools > references find the library, tick it and press ok.

    You will then be able to use this as a normal excel function, so assuming your urls start in A1:
    PHP Code: 
    =getServices(A1
    And drag down

    Edit: The code is attached as the Forum won't let me post it
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Hi, I get what your code's trying to do, but I'm getting an error when I key in getServices -- #VALUE!

  6. #6
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Bump (10Char)

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    Have you added the reference

  8. #8
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Yes (10char)

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    Can you upload your workbook?

  10. #10
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Yes, just give me a minute.

  11. #11
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Here! Thanks! I really appreciate it!
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    I just realized that I have by mistake stated that I am using Excel 2010 --- I'm using 2007. Could that make any difference?

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    Your workbook actually works for me. Try replacing CreateObject("msxml2.xmlhttp") with CreateObject("WinHttp.WinHttpRequest.5.1") and see if it makes any difference. Also, just to be clear, you have ie9, not IE8? This will not work if you only have IE8

  14. #14
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Yes, you pointed correctly. I, in fact, have IE 8. Sorry about the confusion. Didn't realize it before.
    I'll update it and try again.

  15. #15
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Will this work for IE10?

  16. #16
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    yup 10char

  17. #17
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    Hi, nope. I'm still getting an error #NAME?

  18. #18
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    It also says
    Static oHtmFile As HTMLDocument
    User type not defined

  19. #19
    Registered User
    Join Date
    06-19-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Getting data from multiple webpages and posting into one excel sheet

    You seem like an Excel wizard! Any further help will be appreciated!

  20. #20
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Getting data from multiple webpages and posting into one excel sheet

    Then you seem to ave removed the reference to HTML object library.

    Try this:
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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