Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Commndbars collection does not contain menus?

0 views
Skip to first unread message

redtux

unread,
Nov 21, 2007, 7:28:03 AM11/21/07
to
running the folloing code (from helpfiles)

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?

Albert D. Kallal

unread,
Nov 21, 2007, 9:58:46 AM11/21/07
to
Try:

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


redtux

unread,
Nov 21, 2007, 11:56:00 AM11/21/07
to

"Albert D. Kallal" wrote:

> ....etc).


>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOO...@msn.com
>
>
>
>

thanks

0 new messages