• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Clicking a button via IE automation VBA



I'm trying to click a submit/go button on a webpage and I can't seem to get it to work. Everything I've worked with so far seems to have an ID that works well with getElementById call, but with this button i can't seem to find anything that will reference to it and click.

Here's the HTML code from the webpage i think what i need is located in, also following that is the actual webpage.

<div class="ButtonHolder"><div style="display: none;"><input id="btnexcelexport" type="button"></div>
<button class="k-button k-primary" onclick="javascript:fnXlExport('myTable', 'myExcel');" type="button">Data Export</button><div class="ButtonHolder"></div>

Is any otherway to directly click the button


Active Member
Hi AV114
I'm not sure how you would 'click' the button, but perhaps just running the script which the button runs would work?
Something like:
Call IE.document.parentWindow.execScript("fnXlExport('myTable', 'myExcel')", "JavaScript")
Where IE is the webpage object.

I found this idea discussed here. I have been unable to test in your case without access to the webpage etc.


If this was helpful, please click 'Like' in the bottom right!


Excel Ninja
You can simulate clicking of button as following.

Assuming that you have set object variable for the button (i.e. objbttn).
Dim objbttn as Object