VBA to Export File

jhyler02

New Member
Joined
Dec 29, 2009
Messages
7
Hello All,

I am trying to get this code to work properly. As of now it functions as it should with one defect. When the export button is programatically clicked the new window that opens up closes before it finishes loading. Any assistance would be greatly appreciated. Here is the code I am currently using.

Sub ClickIE()

Dim ie As Object
Set ie = CreateObject("internetexplorer.application")

ie.Visible = True
apiShowWindow ie.Hwnd, SW_MAXIMIZE
ie.Navigate "intranet website"
While ie.Busy
DoEvents
Wend
Application.Wait (Now + TimeValue("0:00:4"))
ie.Document.getElementById("ReportViewerControl_ctl00_ctl03_txtValue").Value = Date - 1
ie.Document.getElementById("ReportViewerControl_ctl00_ctl07_txtValue").Value = Date - 1 & " 23:59"
ie.Document.all("ReportViewerControl$ctl00$ctl00").Click
Application.Wait (Now + TimeValue("0:00:4"))
ie.Document.getElementById("ReportViewerControl_ctl01_ctl05_ctl00").Value = "EXCEL"
ie.Document.all("ReportViewerControl_ctl01_ctl06_ctl00").Click
Application.Wait (Now + TimeValue("0:00:4"))
ie.Document.all("ReportViewerControl_ctl01_ctl05_ctl01").Click

End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,784
Messages
6,121,539
Members
449,038
Latest member
Guest1337

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