+ Reply to Thread
Results 1 to 4 of 4

Executing ribbon items

  1. #1
    Registered User
    Join Date
    03-29-2019
    Location
    Fresno, CA
    MS-Off Ver
    2019
    Posts
    55

    Executing ribbon items

    Hi all,

    This should be easy as pie, but for some reason it's a nightmare (to me, anyway)

    Example: I asked how to use VBA to activate the Lasso Select... The answer was:

    Call CommandBars("Drawing").Controls("Select Objects").Execute

    Simple enough... but NOT SO FAST.

    The Ribbon does NOT have a "Drawing" tab! It has a "Draw" tab. And if you call it "Draw" instead of "Drawing", the code fails.

    What this seems to mean is this: The ribbon has "secret" names for everything... so you can't code any interaction with the ribbon unless you know all of the secret names. Now that is frustration set to 11. Why this would be the case is beyond my comprehension.

    Does anyone have a secret decoder wheel where the VBA names are listed for all of the various ribbon items (under their "plain" names?)

    Is there a good place to find a comprehensive "VBA interaction with the ribbon" article?

    Everything I found was about changing the ribbon, or adding items which I specifically want to avoid like the plague.
    Just manage the standard ribbon... all items, every tab.

    Thank you so very much for your kind help.

    R
    Last edited by AliGW; 12-07-2022 at 05:23 AM. Reason: Irrelevant section of title removed.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Should be simple... executing ribbon items

    This will list to the Immediate window the names of all your command bars.

    Please Login or Register  to view this content.

    This will list the controls for a given command bar. In this example, the "Borders" command bar.
    Please Login or Register  to view this content.
    I don't know of a good comprehensive reference for this topic.
    Last edited by AlphaFrog; 12-07-2022 at 01:31 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Should be simple... executing ribbon items

    For the new ribbon controls you can use the name displayed in brackets within the tooltip when looking at all commands in the Customize Ribbon part of Options.

    File > Options > Customize Ribbon

    Office 2016 Help Files: Office Fluent User Interface Control Identifiers
    https://www.microsoft.com/en-us/down....aspx?id=50745
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Should be simple... executing ribbon items

    The Commandbars predate the ribbon - they include the old menu/toolbar system - which is why they don't necessarily correspond to what you see on the Ribbon. As Andy mentioned, the updated version is to use the executemso method with the name of the ribbon control - for example:

    Please Login or Register  to view this content.
    for the lasso select tool.
    Rory

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Disable Items or commands on ribbon in Excel
    By Kelly mort in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2021, 02:21 PM
  2. [SOLVED] Custom Ribbon not executing macros
    By neddyseagoon in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-15-2019, 01:34 PM
  3. [SOLVED] Modifying Excel Ribbon for Executing AddIn Sub Procedures
    By brassrat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-29-2016, 08:45 AM
  4. how to activate greyed out ribbon items?
    By techboy in forum Excel General
    Replies: 13
    Last Post: 12-13-2013, 12:33 PM
  5. Help, Some Ribbon Items Grayed out in Excel 2007?
    By Bud Wilkinsonn in forum Excel General
    Replies: 5
    Last Post: 06-11-2013, 08:19 PM
  6. Excel 2007 : Customizing the ribbon/menu items.
    By LAF in forum Excel General
    Replies: 2
    Last Post: 07-29-2008, 12:37 PM
  7. [SOLVED] Run-time error -2147319784 (80028018) when executing a simple macr
    By Jean-Marc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2005, 02:05 PM

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