Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use VBA code to click on a button on webpage

Tags:

html

click

vba

I am editing a vba program and want to code the vba to click on a button in a webpage. The html for the button is:

<input type="image" src="/lihtml/test_button3.gif" align="left" alt="File_Certificate_Go"/>

I imagine I would have to set a variable to getElementBy??? and then variable.click, but I can't figure out how exactly to get the element (because it doesn't have a name or id, and I can't give it one because it is not my webpage).

Any help is greatly appreciated!

like image 302
dmr Avatar asked Jan 30 '26 17:01

dmr


1 Answers

Perhaps something on the lines of:

Set tags = wb.Document.GetElementsByTagname("Input")

For Each tagx In tags
    If tagx.alt = "File_Certificate_Go" Then
        tagx.Click
    End If
Next

Where wb is the WebBrowser control.

like image 164
Fionnuala Avatar answered Feb 01 '26 08:02

Fionnuala