Consulting

Results 1 to 3 of 3

Thread: Restore "lost" custom menus?

  1. #1

    Restore "lost" custom menus?

    Hello, I made the mistake of allowing macros to run on a commercial Excel spreadsheet I had downloaded to try out. Now a number of my custom menus are gone and I have no idea where they are or how to get them back.

    Any idea on where (or if) Excel 2002 stores custom menus (not toolbars)?


  2. #2
    Also, I've been meaning to do this for awhile due to the risk of loss of these menues. Can someone post a sample "template" of how to create menus using VBA? I used to do this in the "old" Excel macro method but never got around to doing this in VBA.

    While I'm at it, will these methods even work in new Excel for Vista?

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Here is a starter

    [vba]

    Sub MultiLevelMenus()
    Dim oCb As CommandBar
    Dim oCtl1 As CommandBarPopup
    Dim oCtl2 As CommandBarPopup
    Dim oCtl3 As CommandBarPopup
    Dim oCtlBtn As CommandBarButton

    Set oCb = Application.CommandBars("Worksheet Menu Bar")
    With oCb
    Set oCtl1 = .Controls("Tools").Controls.Add( _
    Type:=msoControlPopup, _
    temporary:=True)
    oCtl1.Caption = "Level1"
    With oCtl1
    Set oCtlBtn = .Controls.Add( _
    Type:=msoControlButton)
    oCtlBtn.Caption = "Level1 Button1"
    oCtlBtn.FaceId = 161
    oCtlBtn.OnAction = "myLevel1Button1Macro"
    With oCtl1
    Set oCtl2 = .Controls.Add( _
    Type:=msoControlPopup)
    oCtl2.Caption = "Level2"
    With oCtl2
    Set oCtlBtn = .Controls.Add( _
    Type:=msoControlButton)
    oCtlBtn.Caption = "Level2 Button1"
    oCtlBtn.FaceId = 161
    oCtlBtn.OnAction = "myLevel2Button1Macro"
    Set oCtl3 = .Controls.Add( _
    Type:=msoControlPopup)
    oCtl3.Caption = "Level3"
    With oCtl3
    Set oCtlBtn = .Controls.Add( _
    Type:=msoControlButton)
    oCtlBtn.Caption = "Level3 Button1"
    oCtlBtn.FaceId = 161
    oCtlBtn.OnAction = "myLevel3Button1Macro"
    End With
    End With
    End With
    'etc.
    End With
    End With
    [/vba]

    Vista yes, Excel 2007, well srt of. They create, but theyare part of the addins tab, you don't get menus as you do in 2003.
    ____________________________________________
    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
  •