locked
Disable built-in command bars in Excel 2010 RRS feed

  • Question

  • In Excel 2010, get a Run-Time Error 5 / Invalid procedure call or argument when attempting to run ...

    Application.CommandBars("Toolbar List").Enabled = False

    Any assistance would be appreciated.

    Thanks.

    Wednesday, January 23, 2013 6:47 PM

Answers

  • Mik-

    The sole purpose of Application.CommandBars("Toolbar List").Enabled = False was (in Excel 2003 and earlier) to disable the popup menu you would get by right-clicking on any menubar.  Since Excel 2007 there is no Toolbar List popup to disable so it has no function.

    The only way to disable Ribbon controls is through the Office Fluent UI.  This is an entirely different technology which MS documents here: http://msdn.microsoft.com/en-us/office/aa905530.aspx

    Jim

    • Proposed as answer by Quist Zhang Friday, February 1, 2013 3:02 AM
    • Marked as answer by Mikf Friday, February 1, 2013 3:28 AM
    Thursday, January 31, 2013 7:44 PM

All replies

  • I've tried the code, nothing happend, no error as well.

    Monday, January 28, 2013 6:37 AM
  • Hi Mikf,

    Thank you for posting in the MSDN Forum.

    I've also tried your code, as mentioned by Yuri, I haven't got any error as well.

    Can you still got the error occur ?

    I look forward to your reply.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 31, 2013 1:58 PM
  • Just tried the routine, and for whatever reason does not now produce the error.    Doesn't make sense.

    However, the code line does not disable the toolbars either.  Appears to do nothing.

    ** Have not added an OnError Resume Next, or anything else.

    The objective is to disable every tab on the Ribbon except Add-Ins, where the custom toolbars take over.

    Thanks.

     - Mik

    Thursday, January 31, 2013 5:59 PM
  • Mik-

    The sole purpose of Application.CommandBars("Toolbar List").Enabled = False was (in Excel 2003 and earlier) to disable the popup menu you would get by right-clicking on any menubar.  Since Excel 2007 there is no Toolbar List popup to disable so it has no function.

    The only way to disable Ribbon controls is through the Office Fluent UI.  This is an entirely different technology which MS documents here: http://msdn.microsoft.com/en-us/office/aa905530.aspx

    Jim

    • Proposed as answer by Quist Zhang Friday, February 1, 2013 3:02 AM
    • Marked as answer by Mikf Friday, February 1, 2013 3:28 AM
    Thursday, January 31, 2013 7:44 PM