I'm trying to download a file through Internet Explorer using VBA (after secure login) Its a JSON file, and when navigating to it i get the pop up bar "Do you want to open or save the file"
I've tried many solutions in posts but none seem to work, appreciate any help with this.
I've tried various solutions from stackoverflow, reddit and excel forums
Here is my current VBA to login to the site with IE:
Sub login()
Const Url$ = "https:/xxx.com/2020-01-01"
Dim UserName As String, Password As String, LoginData As Worksheet
Set LoginData = ThisWorkbook.Worksheets("Sheet1")
UserName = LoginData.Range("A1")
Password = LoginData.Range("A2").Value
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate Url
ieBusy ie
.Visible = True
Dim oLogin As Object, oPassword As Object
Set oLogin = .document.getElementsByName("username")(1)
Set oPassword = .document.getElementsByName("password")(0)
oLogin.Value = UserName
oPassword.Value = Password
.document.forms(0).submit
End With
End Sub
Sub ieBusy(ie As Object)
Do While ie.Busy Or ie.readyState < 4
DoEvents
Loop
End Sub