Consulting

Results 1 to 2 of 2

Thread: add a shortcut menu to excel

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    add a shortcut menu to excel

    hello all
    during the course of my excel development hobby i inventerd a lot of menu
    shortcuts.i want to orgnize all of them under one shortcutmenu(suppose to be first item in my shortcut menu).by clicking this menu a list with all my shortcuts will appear.
    [VBA]
    On Error Resume Next
    Dim MenuItem
    CommandBars("Cell").Controls("iris").Delete
    Dim NewItem As CommandBarControl
    Set NewItem = CommandBars("Cell").Controls.Add(Type:=msoControlPopup)
    Set Submenuitem = MenuItem.Controls.Add _
    (Type:=msoControlButton)
    With Submenuitem
    .Caption = "add a new worksheet"
    .FaceId = 420
    .OnAction = "addworksheet5"
    .BeginGroup = True
    End With

    [/VBA]
    i know it's possible i saw some excel add-in having the same feature.
    thanks
    moshe

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    On Error Resume Next
    Dim NewItem As CommandBarPopup
    Dim SubMenuItem As CommandBarButton
    CommandBars("Cell").Controls("iris").Delete
    Set NewItem = CommandBars("Cell").Controls.Add(Type:=msoControlPopup, before:=1)
    NewItem.Caption = "iris"
    Set SubMenuItem = NewItem.Controls.Add(Type:=msoControlButton)
    With SubMenuItem
    .Caption = "add a new worksheet"
    .FaceId = 420
    .OnAction = "addworksheet5"
    .BeginGroup = True
    End With
    Set SubMenuItem = NewItem.Controls.Add(Type:=msoControlButton)
    With SubMenuItem
    .Caption = "delete active worksheet"
    .FaceId = 420
    .OnAction = "deleteworksheet5"
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •