Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Copy table rows from HTML (VBA/Excel/ 2000+)

    I am lost attempting to copy rows x through y of an HTML table so that I can paste them into Excel. Can anyone help me with a snippet?

    T.I.A.
    Regards
    Don

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    Are you automating IE to retrieve the page, or are you using a control in a userform, or is it an Excel web query?

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    I'm using Excel VBA to open a query in the lounge, then selectively capture the returned table, I am adapting the code which you provided <!post=here,572654>here<!/post>.
    Regards
    Don

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    So in that thread, IE opens and VBA uses the MSHTML library to read the structure of the document, including walking through the rows/cells in a table. Using that approach, of course, you could transfer cell contents one at a time. If you want to use the clipboard, hmmm, I don't know whether that actually is possible.

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    Thanks for the consideration Jefferson.

    I will advise of my success--or failure. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Regards
    Don

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    Have you seen this page, after studying the url of a search page you might use it to create a dynamic web query base don a cell:
    http://www.jkp-ads.com/articles/webquery.asp
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copy table rows from HTML (VBA/Excel/ 2000+)

    Thank you Jan Karel

    I have some reading to do. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Regards
    Don

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •