Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Techguy Sr eng.   on Mar 13 In MS Office Category.

  
Question Answered By: Adalwine Fischer   on Mar 13

Sub XPTO()



Dim mymenu





' The following line of code  adds "Perso-Menu" as a new menu  on

' the worksheet menu bar.

Application.MenuBars(xlWorksheet).Menus.Add "Perso-Menu", Before:=8



' Set mymenu to be the menu items.



Set mymenu =
Application.MenuBars(xlWorksheet).Menus("Perso-Menu").MenuItems



With mymenu

.Add Caption:="&Unfilter", OnAction:="File_unfilter" 'Adds Item1

.Add Caption:="&2 Teste", OnAction:="mymacro2" 'Adds Item2

.Add Caption:="&3 Teste", OnAction:="mymacro3" 'Adds Item3

.Add Caption:="&4 Teste", OnAction:="mymacro4" 'Adds Item4

.Add Caption:="&5 Teste", OnAction:="mymacro5" 'Adds Item5

.Add Caption:="&6 Teste", OnAction:="mymacro6" 'Adds Item6

.Add Caption:="&Caculation", OnAction:="Open_Cotation" 'Adds Item7



End With

CommandBars("Worksheet menu bar").Controls("Perso-Menu").Controls("2
Teste").BeginGroup = True

CommandBars("Worksheet menu bar").Controls("Perso-Menu").Controls("4
Teste").BeginGroup = True

CommandBars("Worksheet menu bar").Controls("Perso-Menu").Controls("6
Teste").BeginGroup = True

End Sub

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Menus in VBA Excel Or get search suggestion and latest updates.


Tagged: