I am trying to create a script that opens a page, types a value in, clicks a button on the webpage that downloads a data export, then saves the download, and closes webpage
I have gotten most of it to work. But I cannot figure out how to get the script to select save when the download dialogue box pops open asking "Do you want to open or save..."
I tried the "Application.SendKeys but that does nothing.
It is important to note that the script opens a medium integrity version of internet explorer because that is the only was I could get the "GetElementsByName" function to work. If instead I use CreateObject("InternetExplorer.Application", I can get the SendKeys function to work, but my GetElementsByName function errors out.
Any thoughts on what I can do? Below is my code
Sub GetDataExport()
Dim ARNUM As String
Dim x As Integer
NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
x = 1
For x = 1 To NumRows
ARNUM = Range("A" & x)
Dim IE As Object
Set IE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
IE.Visible = True
IE.navigate "https://qrwb.ecorp.cat.com/cpi/AnalysisTools/Analysis_Tools.cfm?tool=Arrangement"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementsByName("arrangement_no")(0).Value = ARNUM
IE.document.getElementsByName("Download")(0).Click
Application.SendKeys ("%(s)")
Application.SendKeys ("^(w)")
Next x
End Sub