Internet explorer download automation

exc4libur

New Member
Joined
Mar 31, 2011
Messages
19
Hello,
Im trying to download this example file, everything in the code works, except that I can't find out how to press the save or save as button when the dialog box in InternetExplorer appears. I've tried displayalerts, sendkeys and I had no success. Its really frustrating.

Thanks for the help in advance.
Rgds
Exc4.

Code:
Option Explicit
'MICROSOFT INTERNET CONTROLS HAS TO BE CHECKED IN TOOLS > REFERENCES.
Sub IE_PressDownload_Automation()

   Dim objIE As InternetExplorer
   Set objIE = New InternetExplorer

    objIE.Navigate "http://www.bmfbovespa.com.br/BancoTitulosBTC/EmprestimoRegistrado.aspx?Idioma=en-us"
    objIE.Visible = True
     
'Loop unitl ie page is fully loaded.
   Do Until objIE.ReadyState = READYSTATE_COMPLETE
   Loop
   
   On Error Resume Next
    
'ElementID found at page source.
   objIE.Document.getElementById("ctl00_contentPlaceHolderConteudo_lnkDownloadArquivo").Click
'Waiting for download to start and dialog box to popup.
   Application.Wait Now + TimeValue("00:00:03")
   
'This is where I've stopped.
'Internet Explorer opens a dialog box which has 3 options:
'OPEN, SAVE or CANCEL - I want to press "SAVE"

'objIE.Quit
Set objIE = Nothing
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top