Web Scraping / File Saving With VBA? Doable?

I'm trying to save a lot of files from a web site
without having to manually rightclick - save as...

The HTML I'm looking for on the file targets looks like this:

ViewDocument.aspx?DOCID=831259&MIMETYPE=application/pdf
     or
ViewDocument.aspx?DOCID=8424&MIMETYPE=application/vnd.ms-excel

I'm attaching a snippet of code used for code scraping I found on this site.
Is this possible
Sub HTMLScrape(sADDRESS As String)


Dim oHTMLDoc As New HTMLDocument
Dim oDoc As HTMLDocument
Dim oDocElements As IHTMLElementCollection
Dim oElement As IHTMLElement

Dim pos As Long
pos = 0

Set oDoc = oHTMLDoc.createDocumentFromUrl(sADDRESS, "")
Do While oDoc.readyState <> "complete": DoEvents: Loop
Set oDocElements = oDoc.getElementsByTagName("td")

For Each oElement In oDocElements
        Debug.Print CStr(pos), oElement.innerText
        pos = pos + 1
Next

Debug.Print "done"

Set oDocElements = Nothing
Set oDoc = Nothing
Set oHTMLDoc = Nothing

End Sub

Open in new window

LVL 1
JustinWAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

thenelsonCommented:
From what you describe, most likely you will want to download the files using HTTP.  This link will show you how to download files using HTTP and another technique using FTP: http://www.mvps.org/access/modules/mdl0037.htm

Here are other techniques:

You can paste the Microsoft webbrowser control into your Access form/report and then load the web address into its control source.  The web pages will be displayed in the Access form and you can interface with the pages displayed.

You can interface with Internet Explorer using Automation.

You can upload and download files using FTP - File Transfer Protocol.

You can create a hyperlink.  Clicking on the hyperlink will open the web page in the default browser.  To create a hyperlink in a form, go to Insert, Hyperlink.

This sample database will show you how to transfer information to and from the internet using the Web Browser control, Internet Explorer Automation and FTP - www.thenelson.name/#WebAccess
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
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 Excel

From novice to tech pro — start learning today.