Reputation: 999
<div id="CSV"
<li style="width: 100%; float: left; clear: left;">
<input onclick="go('CSV')" type="button"
value="Download in CSV Format" />
</li>
</div>
Trying to download the file by using the onclick function. I have tried the following code, it executes but doesn't download the file.
Set x = ie.document.getElementById("CSV")
x.Click
Also x.onclick gives error and x.FireEvent "onclick" also doesn't work. Please help.
Upvotes: 0
Views: 789
Reputation: 84465
You can also use CSS selector of
input[onclick=go('CSV')]
This says get the input
tag with property onclick= go('CSV')
.
This can be deployed as
ie.document.querySelector("input[onclick=go('CSV')]").Click
The .querySelector
method applies the CSS selector to the HTMLdocument.
Upvotes: 0
Reputation: 999
Set div = ie.document.getElementsByTagName("input")
'loop through all the elements
For Each x In div
' check if the value matches the required value, if it does then use the .click function.
If Trim(x.Value) = "Download in CSV Format" Then
x.Click
Exit For
End If
Next
Upvotes: 1