For Each cb In CommandBars("Menu bar")
If cb.name = "Forms" Then
' cb.Protection = msoBarNoChangeDock
' cb.Visible = True
foundflag = True
Debug.Print cb.name
End If
Next cb
If Not foundflag Then
MsgBox "The collection does not contain a Forms command bar."
End If
results in the popup box coming up
How do I look through available menus?
Dim cb As CommandBarControl
Dim FOUNDFLAG As Boolean
For Each cb In CommandBars("Menu Bar").Controls
Debug.Print cb.Caption
Next
For a "contorl", you use the caption setting...there is no "name" setting..
above output is:
&File
&Edit
&View
&Relationships
&Insert
&Query
&Diagram
F&ormat
&Records
&PivotTable
&PivotChart
Filte&r
&Run
&Tools
&Window
&Help
The menu bar "menu bar" does not contain the "forms" menu.
you can all via
Dim cb As CommandBar <---- note
Dim FOUNDFLAG As Boolean
For Each cb In CommandBars
Debug.Print cb.Name
Next
We get:
Task Pane
Database
Menu Bar
Report Design
Form Design
Toolbox
Source Code Control
test1
Font/Fore Color
Fill/Back Color
Line/Border Style
Line/Border Width
Line/Border Color
Special Effect
Form View
etc. etc.
If you not seeing the additional data types you need to set a references (in
tools->references in code) to:
Microsoft Office 11.0 Object library (office 2003 = 11, office 2002 = 10
...etc).
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOO...@msn.com
"Albert D. Kallal" wrote:
> ....etc).
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOO...@msn.com
>
>
>
>
thanks