+ Reply to Thread
Results 1 to 8 of 8

How to download multi pages of table from the web

  1. #1
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    How to download multi pages of table from the web

    hi, I would like to download tables from this web site (http://sdinotice.hkex.com.hk/di/NSAl...=MAIN&lang=EN&)

    My question is sometimes there are 2 pages of the table while sometimes there is only 1 page. How could I download the entire table if there are more than 1 page of the table? Thanks

    Here the HTML code for the number of pages of the table
    (<TD align="left" bgcolor="#cccccc" class="boldtxt">
    <span id="lblPageIndex">Page <a style="font-size:15px;font-weight:bold" href="/di/NSAllFormList.aspx?sa2=an&sid=25860104&corpn=GOME+Electrical+Appliances+Holding+Ltd.&sd=14%2f10%2f2013&ed=26%2f09%2f2014&sa1=cl&scsd=13%2f10%2f2013&sced=13%2f10%2f2014&sc=493&src=MAIN&lang=EN&&pg=1"><1></a> <a style="font-size:14px;font-weight:bold" href="/di/NSAllFormList.aspx?sa2=an&sid=25860104&corpn=GOME+Electrical+Appliances+Holding+Ltd.&sd=14%2f10%2f2013&ed=26%2f09%2f2014&sa1=cl&scsd=13%2f10%2f2013&sced=13%2f10%2f2014&sc=493&src=MAIN&lang=EN&&pg=2">2</a> <a style="font-size:14px;font-weight:bold" href="/di/NSAllFormList.aspx?sa2=an&sid=25860104&corpn=GOME+Electrical+Appliances+Holding+Ltd.&sd=14%2f10%2f2013&ed=26%2f09%2f2014&sa1=cl&scsd=13%2f10%2f2013&sced=13%2f10%2f2014&sc=493&src=MAIN&lang=EN&&pg=3">3</a> </span>&nbsp;</TD>)

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: How to download multi pages of table from the web

    Try this below code and have test on 2 Pages as well
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: How to download multi pages of table from the web

    Thanks Naveed Raza, I got 2 questions
    1.) the procedure only returns the data from page 1 only no matter I changed the figure to sWebTable
    2.) how should I set the variable to sWebTable in case I want vba to determine how many pages the table contained instead of I hard-code a figure?

    Quote Originally Posted by Naveed Raza View Post
    Try this below code and have test on 2 Pages as well
    Please Login or Register  to view this content.

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

    Re: How to download multi pages of table from the web


    Hi,

    from methods of your previous thread, you can spot on the "Page" ID and with the Count property of a collection
    or you can compare displayed records from total records …
    Last edited by Marc L; 10-13-2014 at 03:16 AM.

  5. #5
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: How to download multi pages of table from the web

    Marc L, could you please explain a little bit more. I am looking for the number of links within id="lblPageIndex"? How should I construct the code? Thanks
    Quote Originally Posted by Marc L View Post

    Hi,

    from methods of your previous thread, you can spot on the "Page" ID and with the Count property of a collection
    or you can compare displayed records from total records …

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

    Re: How to download multi pages of table from the web


    For example, if displayed records are inferior to total records, read next page …

  7. #7
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: How to download multi pages of table from the web

    I am still confused, I tried something like
    Please Login or Register  to view this content.
    , but failed

    Quote Originally Posted by Marc L View Post

    For example, if displayed records are inferior to total records, read next page …

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

    Re: How to download multi pages of table from the web


    Me too : « but failed », very crystal clear about error message for example !

    This is a third thread for the same webpage, if you ever well explained your needs in first one !
    The way you did results in wasting your time (and our !) …

    So check statement in your code line where error occurs from ressource of first thread and amend it ! (bad typo)
    Just create an object variable on the element ID and check in Local variables window its collections …
    Last edited by Marc L; 10-13-2014 at 05:21 AM.

+ 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. Get Data From Multi Web Pages to One Workbook.
    By turist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-30-2014, 05:23 PM
  2. Replies: 19
    Last Post: 10-05-2012, 01:03 PM
  3. [SOLVED] [SOLVED] Excel 2007 will not download training practice pages....help!
    By Gildee in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-04-2006, 09:35 AM
  4. Printer orientation with multi pages
    By skuzapo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2006, 07:35 PM
  5. I want to print multi pages on one page.
    By Laurie in forum Excel General
    Replies: 2
    Last Post: 08-24-2005, 07:05 AM

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