Results 1 to 6 of 6

modify the menu bar

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    modify the menu bar

    I have some code that loads and unloads a command under the "DATA" menu bar.

    Is it possible to add an item to the menu bar and put the commands under the new menu item?

    For example:

    Add "XYZ Consulting" as a menu bar item so it would like as follows:

    File, Edit, Insert, Format, Tools, Data, Window, XYZ Consulting, Help.

    Sub CreateMenu()
    
    Dim Btn             As CommandBarButton
    
        Call DeleteMenu
        
        Set Btn = Application.CommandBars("Worksheet Menu Bar").Controls("Data").Controls.Add
        With Btn
            .Move Before:=1
            .Caption = "Trade &Analysis"
            .OnAction = "TradeAnalysis"
        End With
    
    End Sub
    
    Sub DeleteMenu()
    
        On Error Resume Next
        Application.CommandBars("Worksheet Menu Bar").Controls("Data").Controls("Trade Analysis").Delete
        On Error GoTo 0
    
    End Sub
    Last edited by maacmaac; 03-21-2009 at 08:54 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1