I am trying to export a file from IE, after selecting an item in dropdown by taking the Html ID and clicking the export option, but i am strucked while saving the file.
I am Selecting the option in the dropdown based on the value in an excel range.
Please help.
Below is the code I am trying.
Dim htm As Object
Dim IE As Object
Sub Website()
Dim Doc As Object
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "http://**Link is confidential, sorry for not providing link**"
Do While IE.readystate <> 4: DoEvents: Loop
Set Doc = CreateObject("htmlfile")
Set Doc = IE.document
Set ref = Doc.getelementbyid("ReportViewerControl_ctl01_ctl05_ctl00")
For x = 0 To ref.Options.Length - 1
If ref.Options(x).Text = "Excel" Then
ref.selectedIndex = x
Set refclick = Doc.getelementbyid("ReportViewerControl_ctl01_ctl05_ctl01")
refclick.Click
Set refclick = Nothing
End If
Next
Set IE = Nothing
End Sub
And the snap shot I am strucked here, and here i want to save the file.
Add the following in your code:
Dim Report As Variant
Report = Application.GetSaveAsFilename("Attrition Report.xls", "Excel Files (*.xls), *.xls")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With