Download table from web page

In Access 2010 using VBA I have this procedure to pull a table from website page and download table to access database.

Public Function GetPage(ByVal URL As String) As String
    Dim oXMLHttpRequest As New MSXML2.XMLHTTP
    oXMLHttpRequest.Open "GET", URL, False
    oXMLHttpRequest.send
    GetPage = oXMLHttpRequest.responseText
End Function


Private Sub cmdPullDataFromWSiteTable_Click()
  Dim rawHtml As String, tableChunk As String, tempFile As String
    Dim tmpAt As Long, tableStart As Long, tableEnd As Long
   
   rawHtml = GetPage("http://www.exampleSite.aspx")
 
    ' Search forward until we're just before the table we want
    tmpAt = InStr(1, rawHtml, "Something close to table start tag - example")
   
     
    ' Get the index of the start of the opening <table> tag
    tableStart = InStr(tmpAt, rawHtml, "<table")
     
    ' Get the index of the end of the closing </table> tag
    tmpAt = InStr(tableStart, rawHtml, "</table")
    tableEnd = InStr(tmpAt, rawHtml, ">")
   


   
    ' Extract the table
    tableChunk = Mid(rawHtml, tableStart, tableEnd - tableStart +1)
   
    ' Use native VBA file I/O
    tempFile = "F:\tempTable.Html"
    Open tempFile For Output As #1
    Write #1, tableChunk
 
    Close #1
   
    ' Import the file to a table
    DoCmd.TransferText acImportHTML, , "TestTable", tempFile, True

    ' Delete the temp file
    Kill tempFile
   
End Sub

This works on site where I could see tags for particular table.
I have problem with next site,  site where I can see table in browser  IE but when I open source view  I can not find table tags in source code.
I need to download terminal rack prices table with all those locations.   I do not need legend.
http://www.shell.ca/en/products-services/shell-for-drivers/pricing/app-rack-pricing.html#vanity-e5ecc261fa2a0cdf4b70caad979a7511
Is it possible to  use same steps (procedure or similar)  as I did on site where I can see particular table tags in source code???
TarasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
why not just go after the downloadable CSV file?
0
TarasAuthor Commented:
How to do that?
 I was thinking about it. How to do it from VBA in this particular case.?
0
aikimarkCommented:
Since there is a download CSV link, it isn't clear how their terms and conditions apply.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Jeffrey CoachmanMIS LiasonCommented:
Taras,

...as I am reading this, ...it is not even clear if there is a "Download CSV' link...?
...did I miss something?

In any event, downloading a csv file may be allowed because the site has control over what is actually being downloaded,
...but using code to "scrape" an entire table (without the site's permission, knowledge or consent,) may not be allowed. (as Scott mentioned...)

What we need to know here is if you are "allowed" to do this, ...by expressed permission of the site.
If so, then typically the site will typically provide a more elegant way of getting the data...
(VPN, FTP, custom Export system, ...etc)

The fact that your code works on one site, ...but not on another, points to perhaps the other site not wanting this info to be available/downloaded...

The code you are using there may be interpreted as "Hacking", ...and as such, we at this site are not allowed to respond to such questions...

JeffCoachman

JeffCoachman
0
aikimarkCommented:
@Jeff

The download CSV button is inside the frame in the middle of the page.  It is scrollable content and easy to miss.
0
Jeffrey CoachmanMIS LiasonCommented:
thanks, I see it now
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TarasAuthor Commented:
Thanks for your help I am allowed to donwnload csv file and I will use it. I did not mean to ask for help to do  something that is not permited.And Jeff have point in considering that code is not visible,must  be reason for it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.