VBA to capture active userform label caption

Trebor76

Well-known Member
Joined
Jul 23, 2007
Messages
5,363
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I've been struggling with this for hours, which (in my mind anyway), should be an easy one.

All I want to do is set a string variable with the active label’s (i.e. just clicked) userform caption. The label is a form control not an ActiveX control.

Hope someone can help.

Regards,

Robert
 
Where is MySelection? Can you not simply put the code from MySelection into the class and refer to lbl directly there?
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
MySelection is a macro in main module of the form. I'll have to let this go for tonight.

Cheers Rory ;)
 
Upvote 0
You'd need to put it in a normal module rather than the form module, or make it public.
 
Upvote 0
Can I manipulate a label from a normal module (if so would you mind providing a small example)
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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