<br><font size=2 face="sans-serif">Susan,</font>
<br>
<br><font size=2 face="sans-serif">Here is some code that might help. You will need to modify it as I just took it out of one of my programs that calls it to hide ALL command bars, etc.</font>
<br>
<br><font size=2 face="sans-serif">I hope this helps.</font>
<br>
<br>
<br><font size=2 face="sans-serif">Sub hideCommandBars()</font>
<br><font size=2 face="sans-serif"> Dim cbr As CommandBar</font>
<br><font size=2 face="sans-serif"> For Each cbr In CommandBars</font>
<br><font size=2 face="sans-serif"> hidebar cbr</font>
<br><font size=2 face="sans-serif"> Next cbr</font>
<br><font size=2 face="sans-serif">End Sub</font>
<br><font size=2 face="sans-serif">Sub listbar(level As Integer, thisbar As CommandBar)</font>
<br><font size=2 face="sans-serif"> Dim cbrctl As CommandBarControl</font>
<br><font size=2 face="sans-serif"> Dim indent As Integer</font>
<br><font size=2 face="sans-serif"> ' Indent the command bar depending on its level in</font>
<br><font size=2 face="sans-serif"> ' the menu structure.</font>
<br><font size=2 face="sans-serif"> For indent = 1 To level</font>
<br><font size=2 face="sans-serif"> MsgBox " "</font>
<br><font size=2 face="sans-serif"> Next indent</font>
<br><font size=2 face="sans-serif"> Select Case thisbar.Type</font>
<br><font size=2 face="sans-serif"> Case msoBarTypeMenuBar</font>
<br><font size=2 face="sans-serif"> MsgBox "Menu Bar: " & thisbar.name</font>
<br><font size=2 face="sans-serif"> Case msoBarTypeNormal</font>
<br><font size=2 face="sans-serif"> MsgBox "Toolbar: " & thisbar.name</font>
<br><font size=2 face="sans-serif"> Case msoBarTypePopup</font>
<br><font size=2 face="sans-serif"> MsgBox "Popup: " & thisbar.name</font>
<br><font size=2 face="sans-serif"> End Select</font>
<br><font size=2 face="sans-serif"> For Each cbrctl In thisbar.Controls</font>
<br><font size=2 face="sans-serif"> ' If the control doesn't have a command bar associated</font>
<br><font size=2 face="sans-serif"> ' with it, then don't print it.</font>
<br><font size=2 face="sans-serif"> If cbrctl.Type <> 1 And cbrctl.Type <> 2 _</font>
<br><font size=2 face="sans-serif"> And cbrctl.Type <> 4 And cbrctl.Type <> 16 _</font>
<br><font size=2 face="sans-serif"> And cbrctl.Type <> 18 Then</font>
<br><font size=2 face="sans-serif"> listbar level + 1, cbrctl.CommandBar</font>
<br><font size=2 face="sans-serif"> End If</font>
<br><font size=2 face="sans-serif"> Next cbrctl</font>
<br><font size=2 face="sans-serif">End Sub</font>
<br><font size=2 face="sans-serif">Sub hidebar(thisbar As CommandBar)</font>
<br><font size=2 face="sans-serif"> Dim cbrctl As CommandBarControl</font>
<br><font size=2 face="sans-serif"> Dim indent As Integer</font>
<br><font size=2 face="sans-serif"> ' Indent the command bar depending on its level in</font>
<br><font size=2 face="sans-serif"> ' the menu structure.</font>
<br><font size=2 face="sans-serif"> For indent = 1 To level</font>
<br><font size=2 face="sans-serif"> MsgBox " "</font>
<br><font size=2 face="sans-serif"> Next indent</font>
<br><font size=2 face="sans-serif"> Select Case thisbar.Type</font>
<br><font size=2 face="sans-serif"> Case msoBarTypeMenuBar</font>
<br><font size=2 face="sans-serif"> DoCmd.ShowToolbar thisbar.name, acToolbarNo</font>
<br><font size=2 face="sans-serif"> Case msoBarTypeNormal</font>
<br><font size=2 face="sans-serif"> DoCmd.ShowToolbar thisbar.name, acToolbarNo</font>
<br><font size=2 face="sans-serif"> Case msoBarTypePopup</font>
<br><font size=2 face="sans-serif"> DoCmd.ShowToolbar thisbar.name, acToolbarNo</font>
<br><font size=2 face="sans-serif"> End Select</font>
<br><font size=2 face="sans-serif"> For Each cbrctl In thisbar.Controls</font>
<br><font size=2 face="sans-serif"> ' If the control doesn't have a command bar associated</font>
<br><font size=2 face="sans-serif"> ' with it, then don't print it.</font>
<br><font size=2 face="sans-serif"> If cbrctl.Type <> 1 And cbrctl.Type <> 2 _</font>
<br><font size=2 face="sans-serif"> And cbrctl.Type <> 4 And cbrctl.Type <> 16 _</font>
<br><font size=2 face="sans-serif"> And cbrctl.Type <> 18 Then</font>
<br><font size=2 face="sans-serif"> listbar level + 1, cbrctl.CommandBar</font>
<br><font size=2 face="sans-serif"> End If</font>
<br><font size=2 face="sans-serif"> Next cbrctl</font>
<br><font size=2 face="sans-serif">End Sub</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>"Susan Harkins" <harkins@iglou.com></b></font>
<br><font size=1 face="sans-serif">Sent by: accessd-bounces@databaseadvisors.com</font>
<p><font size=1 face="sans-serif">04/07/2003 02:47 PM</font>
<br><font size=1 face="sans-serif">Please respond to accessd</font>
<br>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To: AccessD@databaseadvisors.com</font>
<br><font size=1 face="sans-serif"> cc: </font>
<br><font size=1 face="sans-serif"> Subject: [AccessD] CommandBarControl subitems</font></table>
<br>
<br>
<br><font size=2 face="Courier New">If a CommandBarControl on a menu bar contains submenus, how do I cycle<br>
through that control's collection to list the submenus? This is driving me<br>
nuts -- I can't figure out how to reference a control's Collection -- does a<br>
control have a collection? I'm assuming it does if there are submenus?????<br>
<br>
<br>
Dim cbarMenu As CommandBar<br>
Dim cbarControl As CommandBarControl<br>
Dim cbarSub As CommandBarControl<br>
'Dim cbarcolControls As CommandBarControls<br>
Set cbarMenu = CommandBars(barname)<br>
For Each cbarControl In cbarMenu.Controls<br>
If cbarControl.Id = controlname Then<br>
For Each control in cbarControl's collection...<br>
<br>
<br>
This is where I get lost -- at this point, I need to declare cbarControl's<br>
collection, and I can't get it.<br>
<br>
<br>
Susan H.<br>
<br>
_______________________________________________<br>
AccessD mailing list<br>
AccessD@databaseadvisors.com<br>
http://databaseadvisors.com/mailman/listinfo/accessd<br>
Website: http://www.databaseadvisors.com<br>
<br>
</font>
<br>
<br>