<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Iterating all controls</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Iterating all controls]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 13 Jun 2026 20:10:43 +0000</pubDate>
  <lastBuildDate>Thu, 09 Sep 2010 11:05:54 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=17221</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Iterating all controls : Thanks, Jason  it would be handy...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60116&amp;title=iterating-all-controls#60116</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=841">Fabian</a><br /><strong>Subject:</strong> 17221<br /><strong>Posted:</strong> 09 September 2010 at 11:05am<br /><br />Thanks, Jason<DIV>&nbsp;</DIV><DIV>it would be handy if the control itself has a global controls collection. </DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 11:05:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60116&amp;title=iterating-all-controls#60116</guid>
  </item> 
  <item>
   <title><![CDATA[Iterating all controls : There was a small bug in my code...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60114&amp;title=iterating-all-controls#60114</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17221<br /><strong>Posted:</strong> 09 September 2010 at 10:35am<br /><br />There was a small bug in my code - lo_Toolbar in EnumAll should have been lo_CommandBar. I've update the code above]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 10:35:07 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60114&amp;title=iterating-all-controls#60114</guid>
  </item> 
  <item>
   <title><![CDATA[Iterating all controls : Hi jpbro,  Thanks a lot. I will...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60113&amp;title=iterating-all-controls#60113</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=841">Fabian</a><br /><strong>Subject:</strong> 17221<br /><strong>Posted:</strong> 09 September 2010 at 10:24am<br /><br />Hi jpbro,<DIV>&nbsp;</DIV><DIV>Thanks a lot. I will check your clean code <img src="http://forum.codejock.com/smileys/smiley32.gif" border="0"></DIV><DIV>&nbsp;</DIV><DIV>Regards</DIV><DIV>Fabian</DIV>]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 10:24:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60113&amp;title=iterating-all-controls#60113</guid>
  </item> 
  <item>
   <title><![CDATA[Iterating all controls :  You need to recursively enumerate...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60112&amp;title=iterating-all-controls#60112</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17221<br /><strong>Posted:</strong> 09 September 2010 at 10:10am<br /><br />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:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>Private Sub EnumAll()<br>&nbsp;&nbsp; Dim lo_CommandBar As CommandBar<br>&nbsp;&nbsp; Dim lo_Control As CommandBarControl<br>&nbsp;&nbsp; Dim i As Long<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; ' Enumerate top-level commandbars and their controls<br>&nbsp;&nbsp; For Each lo_CommandBar In Me.CommandBars1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print lo_CommandBar.Title<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Enumerate this commandbar's controls<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' EnumControls is a recursive function that will also enumerate the child controls controls,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' and the child controls of that's child's controls, etc....<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnumControls lo_CommandBar<br>&nbsp;&nbsp; Next lo_CommandBar<br><br>&nbsp;&nbsp; Exit Sub<br>End Sub<br><br><br>Private Sub EnumControls(po_CommandBar As XtremeCommandBars.CommandBar, Optional ByVal p_IndentLevel As Long = 1)<br>&nbsp;&nbsp; ' p_IndentLevel is used for printing to the debug window, and not needed in production code<br>&nbsp;&nbsp; '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if you don't need to display the control hierarchy in a formatted/indented manner<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; Dim lo_Control As XtremeCommandBars.CommandBarControl<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; For Each lo_Control In po_CommandBar.Controls<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Print the control name at an indentation level that represents it's position in the controls tree<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print String$(p_IndentLevel, vbTab); lo_Control.Caption<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Check to see if this control has a CommandBar child, if so it could have child controls<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' that need enumerating<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Don't test for CommandBar in a CommandBarControlCustom object, because it will raise an error<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' There may be other CommandBar control types that raise errors, you will have to test for this<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not (TypeOf lo_Control Is XtremeCommandBars.CommandBarControlCustom) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' This is not a CommandBarControlCustom object, so let's see if it has a CommandBar<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not (lo_Control.CommandBar Is Nothing) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' This control has a CommandBar, so recursively call this function to enumerate it's controls<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnumControls lo_Control.CommandBar, p_IndentLevel + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp; Next lo_Control<br>End Sub<br></pre></td></tr></table><br><br>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.<br><br><br>]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 10:10:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60112&amp;title=iterating-all-controls#60112</guid>
  </item> 
  <item>
   <title><![CDATA[Iterating all controls : Hi all,   I am searching for...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60102&amp;title=iterating-all-controls#60102</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=841">Fabian</a><br /><strong>Subject:</strong> 17221<br /><strong>Posted:</strong> 09 September 2010 at 1:51am<br /><br />Hi all, <DIV>&nbsp;</DIV><DIV>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:</DIV><DIV>&nbsp;</DIV><DIV>For Each Toolbar in CommandBars</DIV><DIV>&nbsp; For Each Ctrl in Toolbar.Controls</DIV><DIV>...</DIV><DIV>&nbsp;</DIV><DIV>But with this code I never reach the controls in my menues, only controls placed on 'real' toolbars.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Any idea, help?</DIV><DIV>Thanks in advance</DIV><DIV>Fabian</DIV>]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 01:51:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17221&amp;PID=60102&amp;title=iterating-all-controls#60102</guid>
  </item> 
 </channel>
</rss>