1

Excel VBA:
I am trying to get to some activex option buttons through the OLEObjects object, but I am finding that even though I change the value of (Name) in the property window for the object, it still requires the "OptionButton1" default name as a key.

I know that some of the objects in Excel VBA have a code name and another name which is also the one used for the key to get to it from OLEObjects, but I don't know how I can change this "other" name.

I am passing in my object name as a parameter (basically) to a function, so I can't just do :

ActiveSheet.optMyNewName.Value

or whatever. I need to be able to do this:

ActiveSheet.OLEObjects("optMyNewName").Object.Value

but currently only this works:

ActiveSheet.OLEObjects("OptionButton1").Object.Value

1 Answer 1

2

If you pass a string into the OLEObjects collection, it uses the Caption property as the key. Pass the caption as the parameter and it should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.