By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Save a pdf file when opened in a browser object

P: n/a
And
I use shdocvw InternetExplorer Object to open a pdf file and then I
want to automatically save it but the web site from wich I'm
downloading the file doesn't allows to save the file using the
webrequest command so my idea is to save it using the save command from
the internet explorer but it still doen't work!

The code I am using is the following:

Private Sub BtnSave_Click()
Dim eQuery As OLECMDID
Dim bb As Object
bb = CreateObject("InternetExplorer.Application")
bb.navigate("http://somedomain.com/file.pdf")
bb.visible = True
Do While (bb.busy Or bb.readystate <> 4)
System.Threading.Thread.Sleep(50)
Loop

On Error Resume Next
eQuery = bb.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_SAVE)
If Err.Number = 0 Then
If eQuery And SHDocVw.OLECMDF.OLECMDF_ENABLED Then
bb.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVE,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER , "", "")
Else
MsgBox("The Print command is currently disabled.")
End If
End If
If Err.Number <> 0 Then MsgBox("Print command Error: " &
Err.Description)

End Sub
The code works just fine with html pages (changing
SHDocVw.OLECMDID.OLECMDID_SAVE to SHDocVw.OLECMDID.OLECMDID_SAVEAS) but
it doesn't work when ie is displaying a pdf file.

Can anyone help me

Tks in advance

And

May 11 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.