Hello,
I have a macro in Excel 2010 which does the following:
1. Opens Internet Explorer
2. Navigates to a website where a file is available for download (the URL is in Cell A7)
3. Selects 'CSV' as the required format
4. 'Clicks' the Export button to download the file.
What I get next is a 'File Download' window (the usual you get when downloading a file from IE - options are Open, Save or Cancel).
How do I get my macro to recognise this window has appeared and select the 'Open' option?
My macro is below.
Many Thanks for any assistance.
Darren
Sub Test_2()
'
' Test_2 Macro
'
'Various declarations
Dim ie As Object
Dim url As String
Dim ieDoc As Object
Dim SubmitBtn As Object
Set ie = CreateObject("Internetexplorer.Application")
ie.Visible = True
url = Cells(7, "A").Value
ie.Navigate url
While ie.busy
DoEvents
Wend
Application.Wait (Now + TimeValue("0:00:05"))
ie.Document.getElementByID("DownloadFormatID").Value = "CSV"
Set ieDoc = ie.Document
Set SubmitBtn = ieDoc.getElementByID("SubmitButtonID")
SubmitBtn.Click
While ie.busy
DoEvents
Wend
End Sub
Bookmarks