+ Reply to Thread
Results 1 to 7 of 7

Add an item for MACROS to the Excel menu bar

  1. #1
    Registered User
    Join Date
    03-25-2004
    Posts
    54

    Add an item for MACROS to the Excel menu bar

    Friends,

    Please, is it possible...?

    Here we have the usual Excel menu bar:

    File / Edit / View / Insert / Format / Tools / Data / Window / Help

    When we press ALT+F8, a small window appears with all MACROS available for us to run. Is it possible to add an item to the menu bar which shows the same contents that are shown when we press ALT+F8?

    The menu bar should be something like this:

    File / Edit / View / Insert / Format / Tools / Data / Window / Help / Macros

    Then when we press the item "Macros", it shows all macros available (just like the other itens from the menu bar) and when we click one of those macros, it is run!

    (If we open a file which doesn't contain any macros, the item Macros can be hidden... Or not! It's up to you!)

    Anybody knows how to do that?

    Thanks for your attention, guys.

    Hugs.

    Bruno

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Pretty painless...follow these steps:

    with your cursor anywhere on the menu bar, right click and select Customize...

    on the Command tab, scroll down to Tools in the Categories pane, select the "Macros..." from the Commands pane and drag and drop this to the main menu. Right click on this new heading (should be the green arrow) and select "Text Only (always)".

    Click Close on the Customize box.

    Now, click on the Macros... main menu and the Macro Run box opens with all active macros listed.

    BTW, the Visual Basic toolbar has the Run Macro button (green arrow) already on it. You could simply add the VBA toolbar and have all the VBA controls just a click away!

    Good Luck

    Bruce
    Last edited by swatsp0p; 05-09-2005 at 03:54 PM.
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    03-25-2004
    Posts
    54
    swatsp0p,

    Sorry, I guess I didn't make myself clear. I'll try to explain it better...

    Actually, I don't want to open/show the Macros Dialog Box. I just want all availables macros "inside" the new menu.

    For example...

    Inside the menu "File" we have: New / Open / Close / Save / Save As / etc...
    Inside the menu "Edit" we have: Can't Undo / Can't Repeat / Cut / Copy / Paste / etc...
    And so on...

    So, I'd like to know if it's possible to add something like that...

    Inside the new option "Macros" we would have: Macro1 / Macro2 / Macro3 / Macro4 / etc... (all macros available)

    Then, if we want to run Macro3, for example, we click on "Macros" and then click on "Macro3" (and Excel runs Macro3 right away).

    The solutions posted here was a button (a shortcut) to call/show the Macros Dialog Box, but this is not what I really want. Sorry if I didn't express myself correctly.

    So, is it possible to do that (show all available macros inside the menu)? If not, that's OK. I'll use what you taught me first, no problem.

    Anyway, thanks you for the attention. I really appreciate it.

    Hugs.

    Bruno

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Brunces

    What you need to do is open a macro similar to the one below - I've provided you with the outline, you'll have to flesh it out and expand on it. This needs to be opened from an automatic routine within the files that hold the macros, using event procedures (Sub Workbook_Open()) or naming the menu generating macro Sub auto_open().

    Sub auto_open()
    Dim HelpMenu As CommandBarControl
    Dim NewMenu As CommandBarPopup
    Dim MenuItem As CommandBarControl
    Dim Submenuitem As CommandBarButton
    Set HelpMenu = CommandBars(1).FindControl(ID:=30010)
    If HelpMenu Is Nothing Then
    Set NewMenu = CommandBars(1).Controls.Add(Type:=msoControlPopup, temporary:=True)
    Else
    Set NewMenu = CommandBars(1).Controls.Add(Type:=msoControlPopup, Before:=HelpMenu.Index, temporary:=True)
    End If
    NewMenu.Caption = "MyMacro"

    Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
    With MenuItem
    .Caption = "Run Macro 1"
    .OnAction = "Macro1"
    End With

    Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
    With MenuItem
    .Caption = "Run Macro 2"
    .OnAction = "Macro2"
    End With

    End Sub

    You don't need the carriage return breaks I've put in, that's just to help you get to grips with the three seperate "chunks" of code.

    HTH. Good luck!

    DominicB

  5. #5
    Registered User
    Join Date
    03-25-2004
    Posts
    54
    DominicB,

    Hi, I'm gonna check your code now. As soon as I test it, I post an answer to you, OK?

    Thank you very much for your attention, buddy.

    Hugs.

    Bruno

  6. #6
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Add an item for MACROS to the Excel menu bar

    Hi Bruno,

    Did you ever get an answer to your question? I have a few Macros in one workbook that I would like to have a Menu selection for as well.

    Thx,
    Steve

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,665

    Re: Add an item for MACROS to the Excel menu bar

    SCACCHIA,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ Reply to Thread

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