- Local time
- Today, 14:11
- Joined
- Feb 19, 2013
- Messages
- 17,450
I'm trying to create a routine to list all the properties and values used by commandbarcontrols (there are 5 types of control, many common properties and some unique to certain types. In total around 44 properties) in a commandbar.
Unfortunately commandbarcontrols don't have a properties 'property' so code like
won't work. You get the error 'Object doesn't support this property or method
I've also tried using cbc(0) and variations thereof with the same error
And I've tried declaring cbc as a specific type of commandbarcontrol (e.g. button, combo or popup) - same error
At the moment I can only achieve what I want by listing all properties and excluding those that aren't valid with error management e.g.
debug.print "Index"; cbc.index
debug.print "BeginGroup"; cbc.begingroup
debug.print "Caption"; cbc.caption
etc
Note there isn't as Name property
which just seems to be long winded and requires prior knowledge of the various properties - I have the list so that is not the issue and is my fallback position if nothing else works. But just thought it was worth asking if anyone else has any ideas.
Unfortunately commandbarcontrols don't have a properties 'property' so code like
Code:
Dim prp As Property
For Each prp In cbc.properties
Debug.Print prp.Name; prp.Value
Next prp
won't work. You get the error 'Object doesn't support this property or method
I've also tried using cbc(0) and variations thereof with the same error
And I've tried declaring cbc as a specific type of commandbarcontrol (e.g. button, combo or popup) - same error
At the moment I can only achieve what I want by listing all properties and excluding those that aren't valid with error management e.g.
debug.print "Index"; cbc.index
debug.print "BeginGroup"; cbc.begingroup
debug.print "Caption"; cbc.caption
etc
Note there isn't as Name property
which just seems to be long winded and requires prior knowledge of the various properties - I have the list so that is not the issue and is my fallback position if nothing else works. But just thought it was worth asking if anyone else has any ideas.