Can you determine which is the "Active" shape usin

sbendbuckeye

Active Member
Joined
Nov 26, 2003
Messages
440
Hello All,

I am creating a series of CheckBoxes in worksheet based on user actions using this command:
Code:
' strAddress, lngLeft and lngTop are all calculated variables.
With Sheet1.Shapes.AddFormControl(xlCheckBox, lngLeft, lngTop, 10, 10)
    With .DrawingObject
        .Caption = vbNullString
        .LinkedCell = strAddress
    End With
    .Name = "chk" & UCase$(strAddress)
    .OnAction = "CheckBox_Click"
End With
I want to use a generic CheckBox_Click method to handle all of the associated CheckBox events, but I can't find anything to tell me which one has been clicked when the method is called at run time.

There is a parameter property but I am not sure if or how I can use it in this scenario. Am I missing something obvious here? Thanks in advance for any ideas and/or suggestions!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I think what you want to look at is Application.Caller.
Code:
Private Sub CheckBox_Click()
     Msgbox Application.Caller
End Sub
 
Upvote 0
Thanks Norie, that is exactly what I was looking for! I don't do Excel on a daily basis so I forget some of these types of things over time. I was pretty sure it was something in the Application object but couldn't find it.
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,815
Members
448,990
Latest member
rohitsomani

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