Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA to click a button in a excel sheet

Tags:

excel

vba

i need to click a button(FormControl) on an excel sheet and run the macro assigned to it, through VBA code.

I tried what was suggested here https://stackoverflow.com/questions/130166/clicking-command-button-from-other-workbook but it didn't work for me.

Is there any other way to do this ??

like image 910
user1702478 Avatar asked Oct 29 '25 05:10

user1702478


2 Answers

Fairly easy method for doing this, even if it's not really documented.

CommandButton1.Value = True
like image 174
Tristan Reischl Avatar answered Oct 31 '25 01:10

Tristan Reischl


Did you actually try? Because you want exaclty what is suggested there.

Application.Run Activesheet.Shapes(1).OnAction
like image 37
GSerg Avatar answered Oct 31 '25 00:10

GSerg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!