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.
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