ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code needed to test if user clicked a button (https://www.excelbanter.com/excel-programming/341096-code-needed-test-if-user-clicked-button.html)

Subs

Code needed to test if user clicked a button
 
Hi all

Please can anybody help I need the correct syntax, to check If a user has
clicked on a button .

Regards

Subs



Tom Ogilvy

Code needed to test if user clicked a button
 
You would need to handle that in the click event of the the button. Then
you wouldn't have to text, because the code would execute when they click
the button.

Beyond that, you would need to be much more specific about what type of
button you are working with and when you would want to determine this
information and why -- what you want to do.

--
Regards,
Tom Ogilvy


"Subs" wrote in message
...
Hi all

Please can anybody help I need the correct syntax, to check If a user has
clicked on a button .

Regards

Subs





Ken Johnson

Code needed to test if user clicked a button
 
Subs,
If it's a button on a worksheet from the forms toolbar then
Application.Caller returns the button's name. If you want to identify
the button using its caption eg "Start" then try:
Dim WhichButton as Shape
Set WhichButton = ActiveSheet.Shapes(Application.Caller)
If WhichButton.TextFrame.Characters.Text = "Start" then do something..
Other than that I really don't know. I mainly work on a Mac so I know
nothing about ActiveX controls.
Ken Johnson



All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com