Share via

Application.Commandbars ("xxx").Enabled = False does not work?

Anonymous
2011-07-23T21:44:13+00:00

I have the following code in the Private Sub Workbook_Open ()

... (there's a bunch of code that preceeds this)

    Application.CommandBars("Worksheet Menu Bar").Enabled = False

    Application.CommandBars("Cell").Enabled = False

    Application.CommandBars("Sheet").Enabled = False

    Application.CommandBars("Ply").Enabled = False

    Application.CommandBars("Row").Enabled = False

    Application.CommandBars("Column").Enabled = False

    Application.CellDragAndDrop = False

but nothing happens - the right click still works, the ribbon is still visible, etc.

What's missing?

kala sha

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2011-07-24T20:04:43+00:00

    Sorry, my mistake.  I thought you were refering to Toolbars.

    Just a check, are there any other events in the sheet you added that could be conflicting with your code?

    Cheers

    Rich

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-07-24T18:34:05+00:00

    the Application.CommandBars does work in Excel 2007.  I use the same coding in other workbooks and there are no issues.

    in this workbook, I added a worksheet and the mouse right click still shows options.  In the other worksheets - the application.commandbars (false) does work properly.  Just the worksheet that i added to the workbook is giving me grief.

    kala

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-07-24T02:06:48+00:00

    Don't think you can do that with Office 2007 or 2010. Have a look at:

    http://msdn.microsoft.com/en-us/library/aa338202.aspx  (Part1)

    http://msdn.microsoft.com/en-us/library/aa338199(office.12).aspx  (Part2)

    http://msdn.microsoft.com/en-us/library/aa722523.aspx  (Part3) 

    Part 2 is espically useful.

    Welcome to Ribon xml H€LL.

    Cheers Rich

    Was this answer helpful?

    0 comments No comments