I use shdocvw InternetExplore r 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("I nternetExplorer .Application")
bb.navigate("ht tp://somedomain.com/file.pdf")
bb.visible = True
Do While (bb.busy Or bb.readystate <> 4)
System.Threadin g.Thread.Sleep( 50)
Loop
On Error Resume Next
eQuery = bb.QueryStatusW B(SHDocVw.OLECM DID.OLECMDID_SA VE)
If Err.Number = 0 Then
If eQuery And SHDocVw.OLECMDF .OLECMDF_ENABLE D Then
bb.ExecWB(SHDoc Vw.OLECMDID.OLE CMDID_SAVE,
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DONTPROMP TUSER, "", "")
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.OLECMDI D.OLECMDID_SAVE to SHDocVw.OLECMDI D.OLECMDID_SAVE AS) but
it doesn't work when ie is displaying a pdf file.
Can anyone help me
Tks in advance
And
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("I nternetExplorer .Application")
bb.navigate("ht tp://somedomain.com/file.pdf")
bb.visible = True
Do While (bb.busy Or bb.readystate <> 4)
System.Threadin g.Thread.Sleep( 50)
Loop
On Error Resume Next
eQuery = bb.QueryStatusW B(SHDocVw.OLECM DID.OLECMDID_SA VE)
If Err.Number = 0 Then
If eQuery And SHDocVw.OLECMDF .OLECMDF_ENABLE D Then
bb.ExecWB(SHDoc Vw.OLECMDID.OLE CMDID_SAVE,
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DONTPROMP TUSER, "", "")
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.OLECMDI D.OLECMDID_SAVE to SHDocVw.OLECMDI D.OLECMDID_SAVE AS) but
it doesn't work when ie is displaying a pdf file.
Can anyone help me
Tks in advance
And