Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving pdfs from IE 7 to local files 1

Status
Not open for further replies.

Chesterex1

Vendor
Mar 31, 2003
34
0
0
CA
I have a series (over 800) pdf files I need to take down from server site and save locally. I think I am 1/2 the way there with code below - just need to know a quick way I can Save the document as a pdf once it loads in the Browser window (I had assumed there would be a reference for the SaveAs command within the Browser - but no luck):

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set Ie = CreateObject("InternetExplorer.Application")
Ie.Visible = True
Ie.navigate "
Do While Ie.Document Is Nothing
wScript.sleep 50
Loop
Do While Ie.Document.body Is Nothing
wScript.sleep 50
Loop

XXX.SAVE THEDOCUMENT as "c:\local\pdf1.pdf"

ANy help or direction would be Greatly appreciated!!!
 
I'd recommend that you use Microsoft.XMLHTTP instead.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
basic example....

Code:
Option Explicit

Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

Dim strUrl : strUrl = "[URL unfurl="true"]http://ati.amd.com/technology/Avivo/pdf/ATI_Avivo_HD_tech_brief.pdf"[/URL]
Dim objXMLHTTP : Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", strUrl, False
objXMLHTTP.Send
Dim binData : binData = objXMLHTTP.ResponseBody

Dim objADOStream : Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Type = adTypeBinary
objADOStream.Open
objADOStream.Write binData
objADOStream.SaveToFile "C:\temp\ATI_Avivo_HD_tech_brief.pdf", adSaveCreateOverWrite

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
You, sir or madam, are a genius!
I was wasting time and banging my head for hours yesterday.
This will save a lot of manual work!!
Thank you VERY Much!!
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top