![]() |
Iterating all controls |
Post Reply ![]() |
Author | |
Fabian ![]() Senior Member ![]() ![]() Joined: 22 November 2004 Location: Switzerland Status: Offline Points: 336 |
![]() ![]() ![]() ![]() ![]() Posted: 09 September 2010 at 1:51am |
Hi all,
I am searching for a simple way to enumerate all controls of all commandbars AND menues. It seems no problem to accomplish this task by simply:
For Each Toolbar in CommandBars
For Each Ctrl in Toolbar.Controls
...
But with this code I never reach the controls in my menues, only controls placed on 'real' toolbars.
Any idea, help?
Thanks in advance
Fabian
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit) Language: Visual Basic 6.0 / SP6 |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1355 |
![]() ![]() ![]() ![]() ![]() |
You need to recursively enumerate child CommandBars of the CommandBarControls that you find. I haven't completely tested this code, but it should at least point you in the right direction:
Call EnumAll (changing the reference of Me.CommandBars1 to the name of your CommandBars control) and you should get a list of all controls printed to the debug window. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
Fabian ![]() Senior Member ![]() ![]() Joined: 22 November 2004 Location: Switzerland Status: Offline Points: 336 |
![]() ![]() ![]() ![]() ![]() |
Hi jpbro,
Thanks a lot. I will check your clean code
![]() Regards
Fabian
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit) Language: Visual Basic 6.0 / SP6 |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1355 |
![]() ![]() ![]() ![]() ![]() |
There was a small bug in my code - lo_Toolbar in EnumAll should have been lo_CommandBar. I've update the code above
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
Fabian ![]() Senior Member ![]() ![]() Joined: 22 November 2004 Location: Switzerland Status: Offline Points: 336 |
![]() ![]() ![]() ![]() ![]() |
Thanks, Jason
it would be handy if the control itself has a global controls collection.
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit) Language: Visual Basic 6.0 / SP6 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |