Name of combo box that is being changed

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79
how do I get the name of the combo box that the user has clicked on? I mean, to get the reference for a button I have used ActiveSheet.Buttons(Application.Caller), but is there something like that I can use so when the subroutine is called for the change event on the combo box I can know which box is being changed? I ask because I have several different combo boxes I would like to have the same sub run for and I don't necessarily know the name of the box when it is clicked. Thanks in advance.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Application.Caller should work with comboboxes as well as command buttons.

You might not be able to refer to a collection called Buttons but you should at least get the name.

PS Application.Caller only works for controls created from the Forms toolbar, or is it the Control Toolbox. It's one or the other anyway.:)

PPS Why do you need/want the name of the combobox name anyway?
 
Upvote 0
What is the specific syntax of application caller that I should use to get the name of the combo box though? Example, say I wanted to display the name of the combo box that was clicked, what would I put in the msgbox tag?
MsgBox(Application.Caller?)

The reason I want to know is because I have a bunch of different combo boxes that get created on the fly and when a specific one is clicked I want to do something to the properties of just that one combo box, so I need to get the reference of the specific box that was changed.
 
Upvote 0
Thanks for the answer, but I guess I need to specifically know the syntax for what I'm asking, which is what is the code to reference the combo box that was clicked? If it can be accessed with the Shapes collection, please explain what specific syntax will return the name of the combo box.

Thanks for the prompt replies everyone!
 
Upvote 0
Actually, upon looking into it more it appears that I'm actually looking to get the name of an ActiveX combo box, not a forms control.
 
Upvote 0
Actually you need to be in Design View to view the Active-X Controls name(s). Depending on the version you are running determines how you get to the design view.
 
Upvote 0
If the control is an ActiveX control, then clicking on it triggers an event that is specific to that control.

Have you tried
Code:
MsgBox ActiveSheet.Shapes(Application.Caller).Name
I'm not as sure as I am about Forms controls, but I think it should work.
 
Upvote 0
There is no specific syntax for Application.Caller and it takes no arguments.

It only works with controls from the Forms toolbar as far as I'm aware.

If you are working with ActiveX controls you'll need another approach.

What that is exactly depends on what you are actually trying to do.
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,266
Members
448,558
Latest member
aivin

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