I am downloading Climate XML data into Excel 2013. I need to automate the process and I can navigate immediately to the correct page preloaded with the correct parameters. I can click on the OK button but then the Internet Explorer - Open/Save/Cancel dialogue box comes up.
I have tried various option in Windows 7 to trap the Windows event 32770 (??) but am I unsure how to code this. I just want to save the file as c:\temp.xml
.
I don't want to use the SendKeys
method as it is too unreliable. Can anyone suggest a way to handle the dialog ?
Dim htm As Object
Dim IE As Object
Dim Doc As Object
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "http://ec.europa.eu/environment/ets/exportEntry.do?form=transaction&destinationAccountHolder=&startDate=01%2F06%2F2009&destinationRegistry=-1&originatingAccountType=-1&endDate=01%2F05%2F2010&transactionID=&suppTransactionType=-1&originatingAccountHolder=&transactionType=-1&languageCode=en&destinationAccountNumber=&destinationAccountType=-1&toCompletionDate=&originatingRegistry=-1&destinationAccountIdentifier=&fromCompletionDate=&originatingAccountIdentifier=&transactionStatus=4&originatingAccountNumber=8¤tSortSettings="
Do While IE.readystate <> 4: DoEvents: Loop
Set Doc = CreateObject("htmlfile")
Set Doc = IE.document
Doc.getelementbyID("btnOK").Click
Set IE = Nothing