shahin
Active Member
I've created a macro to download some files from a webpage. The thing is I can only scrape the links to those files. As I never worked with downloading files from websites, I got stuck and can't go ahead. Any help as to how i can accomplish this will be greatly appreciated. Thanks in advance.
Here is what I've written so far:
Output:
How can i download these files and save in my desktop?
Here is what I've written so far:
Code:
Sub download_files()
Dim HTTP As New XMLHTTP60, html As New HTMLDocument, post As Object
With HTTP
.Open "GET", "http://usda.mannlib.cornell.edu/MannUsda/viewDocumentInfo.do?documentID=1194", False
.send
html.body.innerHTML = .responseText
End With
For Each post In html.getElementById("latest").getElementsByTagName("a")
Debug.Print post.href
Next post
End Sub
Output:
Code:
http://usda.mannlib.cornell.edu/usda/current/wasde/wasde-12-12-2017.pdf
http://usda.mannlib.cornell.edu/usda/current/wasde/wasde-12-12-2017.txt
http://usda.mannlib.cornell.edu/usda/current/wasde/wasde-12-12-2017.xls
http://usda.mannlib.cornell.edu/usda/current/wasde/wasde-12-12-2017.xml