Hi guys,
I am trying my hardest to figure out how I can save a pdf file on a website automatically. I have got to the point where I am prompted to Open/Save/Cancel the file.
I want to be able to save the file automatically into a folder whose path is specified by a cell. Thanks for any help.
I am trying my hardest to figure out how I can save a pdf file on a website automatically. I have got to the point where I am prompted to Open/Save/Cancel the file.
I want to be able to save the file automatically into a folder whose path is specified by a cell. Thanks for any help.
Code:
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWNORMAL = 1
Sub OpenIE2()
Dim Report As Variant
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://e-services.esv.vic.gov.au/"
apiShowWindow IE.hWnd, SW_MAXIMIZE
While IE.Busy
DoEvents
Wend
' **********************************************************************
delay 1
IE.Document.All("UserID").Value = "Username"
IE.Document.All("Password").Value = "Password"
IE.Document.All("btn").Click
delay 1
IE.Navigate "https://e-services.esv.vic.gov.au/Cert/PrintCOES?certno=" & ThisWorkbook.Worksheets("Calculator").Range("H27").Value
[COLOR=#ff0000]'****This will prompt Internet Explorer to download the pdf file. It then gives me the option to Open/Save/Cancel. I'm using IE 11
'****I am trying to figure out how to save the file directly into a folder, specified by a cell reference. I need to be logged in order to be able to access the file
'****which is why I think I am limited to using Internet Explorer through excel. [/COLOR]
[COLOR=#ff0000] [/COLOR]
'**********************************************************************
Set IE = Nothing
End Sub
Private Sub delay(seconds As Long)
Dim endTime As Date
endTime = DateAdd("s", seconds, Now())
Do While Now() < endTime
DoEvents
Loop
End Sub