I have the following code to download a file from the web, but I have to manually do a Save As
.
Dim Filename As String
Dim ieApp As Object
Dim URL As String
URL = Range("All_Quad_URL")
Filename = "C:\Historic_Weather_Data\Precipitation\" & Range("File_Name").Value
Set ieApp = CreateObject("InternetExplorer.Application")
ieApp.Visible = True
ieApp.Navigate URL
While ieApp.Busy Or ieApp.ReadyState <> 45
DoEvents
Wend
ieApp.Quit
Set ieApp = Nothing
I would like to automate Save As
. I have tried the following with no luck:
Controlling IE11 "Do you want to Open/Save" dialogue window buttons in VBA
I still get the "View Downloads - Internet Explore" dialog box with the open/save options. I changed the FindWindowEX
to h = FindWindowEx(h, 0, "View Downloads - Internet Explorer", vbNullString)
The file name and location for the Save As needs to be
Filename = "C:\Historic_Weather_Data\Precipitation\" & Range("File_Name").Value
I am also getting
Run-time error "-2147467259 (80004005)': Method 'Busy' of object 'IWebBrowser 2' failed"
that debugs to the While ieApp.Busy
line.
Any help is appreciated.