Detect mouse click on link inside userform webbrowser

deeme

New Member
Joined
Nov 17, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a userform with a webbrowser filling 100% of the form. The source html is a local file and acts as a switch with six large 'buttons' on it. When one of the buttons are clicked it opens a userform which corresponds to that button. How can I detect if one of the six buttons are clicked and then open the corresponding userform? I can use getElementsByClassName("a01") to reference each button, but don't know how to detect an actual mouse click on it. Do I detect the click using excel vba, or do I add code to the html which executes a macro once the link is clicked?
example html of one of the buttons:
<div class="col-rt-4">
<img class="image" src="img/ins-00.gif" alt="">
<a class="a01" href="">
<div class="overlay">
<img class="image" src="img/ins-00.jpg" alt="">
<h1 class="no-select">Inspection Form</h1>
</div>
</a>
</div>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
maybe this
or this

or use vba and the initialize event of the opened userform?
 
Upvote 0
Solution
Yes, the onclick=myFunction() should do what I'm looking for. Thanks!
 
Upvote 0

Forum statistics

Threads
1,225,436
Messages
6,184,975
Members
453,271
Latest member
Vizeey

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