Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50099

Get Caption From Userform CommandButton During Click Event Procedure

$
0
0
I have a command button and in the ClickEvent code, while it is running, I want to capture the caption of the command button.

I know I can access it by Me.CommandButton1.Caption and that's what I'm doing and my use of the caption is working perfectly.

I want to paste the heart of the code into 52 other command buttons and access the caption of each one without having to change the code.

I found on Ozgrid that I could use ActiveControl, it works if the command button is on a regular form, I've test it.

These command buttons are on multipages and when I use activecontrol it returns the multipage as the active control.

There's a property for the command button called TakeFocusOnClick and it's set to True, but that doesn't seem to be helping, for some reason the multipage and not the command button I clicked is considered the active control.

Any help would be appreciated.

Viewing all articles
Browse latest Browse all 50099

Trending Articles