I want to download a file via an URL, using VBA. How can I click on "save as" or "open", without using the "sendkeys" command?
This is my code so far:
Sub Orders_downloaden()
Dim i As Long
Dim ie As Object
Dim objElement As Object
Dim objCollection As Object
' Create InternetExplorer Object
Set ie = CreateObject("InternetExplorer.Application")
'IE.Visible = False
ie.navigate "http://k2b-bulk.ebay.com/ws/eBayISAPI.dll?SMDownloadPickup"
' Wait while IE loading...
Do While ie.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
ie.Visible = True
Set link = ie.Document.getelementsbytagname("a")
For Each l In link
If l.innertext = "Download" Then
l.Click
Dim Report As Variant
Report = Application.GetSaveAsFilename("Orders.csv", "Excel Files (*.csv), *.csv")
'Shell ("C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -url " & l), vbHide
Exit For
End If
Next l
End Sub
Does someone have any idea how to manage this?