jeffrey.demulling at usbank.com
jeffrey.demulling at usbank.com
Mon Apr 7 15:08:55 CDT 2003
Susan,
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.
I hope this helps.
Sub hideCommandBars()
Dim cbr As CommandBar
For Each cbr In CommandBars
hidebar cbr
Next cbr
End Sub
Sub listbar(level As Integer, thisbar As CommandBar)
Dim cbrctl As CommandBarControl
Dim indent As Integer
' Indent the command bar depending on its level in
' the menu structure.
For indent = 1 To level
MsgBox " "
Next indent
Select Case thisbar.Type
Case msoBarTypeMenuBar
MsgBox "Menu Bar: " & thisbar.name
Case msoBarTypeNormal
MsgBox "Toolbar: " & thisbar.name
Case msoBarTypePopup
MsgBox "Popup: " & thisbar.name
End Select
For Each cbrctl In thisbar.Controls
' If the control doesn't have a command bar associated
' with it, then don't print it.
If cbrctl.Type <> 1 And cbrctl.Type <> 2 _
And cbrctl.Type <> 4 And cbrctl.Type <> 16 _
And cbrctl.Type <> 18 Then
listbar level + 1, cbrctl.CommandBar
End If
Next cbrctl
End Sub
Sub hidebar(thisbar As CommandBar)
Dim cbrctl As CommandBarControl
Dim indent As Integer
' Indent the command bar depending on its level in
' the menu structure.
For indent = 1 To level
MsgBox " "
Next indent
Select Case thisbar.Type
Case msoBarTypeMenuBar
DoCmd.ShowToolbar thisbar.name, acToolbarNo
Case msoBarTypeNormal
DoCmd.ShowToolbar thisbar.name, acToolbarNo
Case msoBarTypePopup
DoCmd.ShowToolbar thisbar.name, acToolbarNo
End Select
For Each cbrctl In thisbar.Controls
' If the control doesn't have a command bar associated
' with it, then don't print it.
If cbrctl.Type <> 1 And cbrctl.Type <> 2 _
And cbrctl.Type <> 4 And cbrctl.Type <> 16 _
And cbrctl.Type <> 18 Then
listbar level + 1, cbrctl.CommandBar
End If
Next cbrctl
End Sub
"Susan Harkins" <harkins at iglou.com>
Sent by: accessd-bounces at databaseadvisors.com
04/07/2003 02:47 PM
Please respond to accessd
To: AccessD at databaseadvisors.com
cc:
Subject: [AccessD] CommandBarControl subitems
If a CommandBarControl on a menu bar contains submenus, how do I cycle
through that control's collection to list the submenus? This is driving me
nuts -- I can't figure out how to reference a control's Collection -- does
a
control have a collection? I'm assuming it does if there are submenus?????
Dim cbarMenu As CommandBar
Dim cbarControl As CommandBarControl
Dim cbarSub As CommandBarControl
'Dim cbarcolControls As CommandBarControls
Set cbarMenu = CommandBars(barname)
For Each cbarControl In cbarMenu.Controls
If cbarControl.Id = controlname Then
For Each control in cbarControl's collection...
This is where I get lost -- at this point, I need to declare cbarControl's
collection, and I can't get it.
Susan H.
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030407/a69ded3d/attachment-0001.html>