ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2007 Menus (https://www.excelbanter.com/excel-programming/396507-excel-2007-menus.html)

JasonB

Excel 2007 Menus
 
I am creating a menu with code that works in 03 to create a menu, and when I
call the routine, in Excel 07, the menu goes into the Add-Ins tab of the
ribbon. If I Hide the ribbon with a different routine, the code does not
make this section visible. Here is a section of the code:


Code:

Dim myBar As CommandBar
'Dim SubItem As CommandBarButton
Dim myItem As CommandBarControl

On Error Resume Next 'In case it has already gone.
    Application.CommandBars("Navigation_Bar").Delete
On Error GoTo 0

Set myBar = Application.CommandBars.Add(MenuBar:=True)
    With myBar
    .Name = "Navigation_Bar"
    .Visible = True
    '.Position=msoBarFloating
    'Temporary:=True)
    End With
'Add Menu Item
Set myItem = myBar.Controls.Add(Type:=msoControlPopup)
With myItem
    .Caption = "Actions"
    .BeginGroup = True
'    .FaceId = 334
End With
   
    'First Sub Item
    Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
    With mySubItem
        .Caption = "Load Components"
        .OnAction = "Load_Components"
    End With
    Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
    With mySubItem
        .Caption = "Delete Navigation Bar"
        .OnAction = "Delete_Navigation_Bar"
    End With


What I would like is a clean menubar with only items in it that I created
like it works in 03. I would be open to another option, but hopefully not
the full Ribbon... It takes up too much room...

Bob Phillips

Excel 2007 Menus
 
Not possible. The ribbon is not as configurable as the old commandbars. You
either have it all or nothing.

You can create your own group using XML, but it will still be part of a full
ribbon.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"JasonB" wrote in message
...
I am creating a menu with code that works in 03 to create a menu, and when
I
call the routine, in Excel 07, the menu goes into the Add-Ins tab of the
ribbon. If I Hide the ribbon with a different routine, the code does not
make this section visible. Here is a section of the code:


Code:

Dim myBar As CommandBar
'Dim SubItem As CommandBarButton
Dim myItem As CommandBarControl

On Error Resume Next 'In case it has already gone.
    Application.CommandBars("Navigation_Bar").Delete
On Error GoTo 0

Set myBar = Application.CommandBars.Add(MenuBar:=True)
    With myBar
    .Name = "Navigation_Bar"
    .Visible = True
    '.Position=msoBarFloating
    'Temporary:=True)
    End With
'Add Menu Item
Set myItem = myBar.Controls.Add(Type:=msoControlPopup)
With myItem
    .Caption = "Actions"
    .BeginGroup = True
'    .FaceId = 334
End With

    'First Sub Item
    Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
    With mySubItem
        .Caption = "Load Components"
        .OnAction = "Load_Components"
    End With
    Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
    With mySubItem
        .Caption = "Delete Navigation Bar"
        .OnAction = "Delete_Navigation_Bar"
    End With



What I would like is a clean menubar with only items in it that I created
like it works in 03. I would be open to another option, but hopefully not
the full Ribbon... It takes up too much room...




Jim Rech

Excel 2007 Menus
 
but it will still be part of a full ribbon.

startFromScratch?



--
Jim
"Bob Phillips" wrote in message
...
| Not possible. The ribbon is not as configurable as the old commandbars.
You
| either have it all or nothing.
|
| You can create your own group using XML, but it will still be part of a
full
| ribbon.
|
| --
| HTH
|
| Bob
|
| (there's no email, no snail mail, but somewhere should be gmail in my
addy)
|
| "JasonB" wrote in message
| ...
| I am creating a menu with code that works in 03 to create a menu, and
when
| I
| call the routine, in Excel 07, the menu goes into the Add-Ins tab of the
| ribbon. If I Hide the ribbon with a different routine, the code does
not
| make this section visible. Here is a section of the code:
|
|
|
Code:

Dim myBar As CommandBar
| 'Dim SubItem As CommandBarButton
| Dim myItem As CommandBarControl
|
| On Error Resume Next 'In case it has already gone.
|     Application.CommandBars("Navigation_Bar").Delete
| On Error GoTo 0
|
| Set myBar = Application.CommandBars.Add(MenuBar:=True)
|     With myBar
|     .Name = "Navigation_Bar"
|     .Visible = True
|     '.Position=msoBarFloating
|     'Temporary:=True)
|     End With
| 'Add Menu Item
| Set myItem = myBar.Controls.Add(Type:=msoControlPopup)
| With myItem
|     .Caption = "Actions"
|     .BeginGroup = True
| '    .FaceId = 334
| End With
|
|     'First Sub Item
|     Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
|     With mySubItem
|         .Caption = "Load Components"
|         .OnAction = "Load_Components"
|     End With
|     Set mySubItem = myItem.Controls.Add(Type:=msoControlButton)
|     With mySubItem
|         .Caption = "Delete Navigation Bar"
|         .OnAction = "Delete_Navigation_Bar"
|     End With

|
|
| What I would like is a clean menubar with only items in it that I
created
| like it works in 03. I would be open to another option, but hopefully
not
| the full Ribbon... It takes up too much room...
|
|




All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com