0

This is not the usual Open, Save, Cancel prompt at the bottom of the IE Window, that one I know how to find with VBA. For some reason on this specific website I get the "old school" type of dialog and I have no idea how to interact with VBA without using Send Keys.

Here is a screenshot of the IE11 Popup.

IE Popup

For all other websites I get the usual Save As bottom bar, but not for this one. Anyone has any ideas on how to find this popup window with VBA? Urlmon works with the URL but I am looking for a way to Select the option in this dialog because Urlmon is for some reason blocked on a coworker's computer and I need it to download for that PC too. Thanks everyone.

1 Answer 1

0

I try to search about handling the above-mentioned popup using VBA but all the solutions I got are for automating the bottom bar popup.

If your goal is to just download the Excel file then you can try to refer to the approach below as a workaround for this issue.

I found that this kind of popup gets displayed by the IE when there is a file name in the link.

For example: https://example.com/samplefile.xlsx

You can easily try to get the file URL from the source code or from the IE address bar.

After that, you can try to pass that file URL in the code below may help you to download the file.

Sub test()

Dim myURL As String
myURL = "https://YOUR_URL_HERE/File_Name.xlsx" 'Please modify the file URL here...

Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False, "username", "password"
WinHttpReq.send

If WinHttpReq.Status = 200 Then
    Set oStream = CreateObject("ADODB.Stream")
    oStream.Open
    oStream.Type = 1
    oStream.Write WinHttpReq.responseBody
    oStream.SaveToFile "D:\test.xlsx", 2  'Please modify the download location here...
    oStream.Close
End If

End Sub

Reference:

How do I download a file using VBA (without Internet Explorer)

I have tested this code on my side and it downloads the file properly. Further, you can try to modify the code example as per your own requirements.

3
  • Thank you, i'll give it a try.
    – Ricardo A
    Commented Nov 12, 2020 at 22:13
  • You can test it on your side and let us know whether it works for you or not. Commented Nov 16, 2020 at 2:28
  • Working good, thank you for the workaround. I still want to find a way to click that damn dialog but that can wait for now hahaha.
    – Ricardo A
    Commented Nov 19, 2020 at 16:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.