+ Reply to Thread
Results 1 to 4 of 4

Disable delete sheet in Excel 2010

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2010
    Posts
    6

    Question Disable delete sheet in Excel 2010

    In Excel 2003, I had a macro that disabled the delete sheet command. I've recently upgraded to Excel 2010 and the old macro doesn't work any more.

    Application.CommandBars("Worksheet Menu Bar").Controls("Edit") _
    .Controls("Delete Sheet").Enabled = False

    Any suggestions on how to do this in Excel 2010?

    I'd also like to disable the rename command.

    In fact, I'd like to disable the right-click menu on the sheet tab too.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Disable delete sheet in Excel 2010

    Disabling the Right Click menu is simple enough. Just put this code the the ThisWorkbook code module
    Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
        Cancel = True
    End Sub
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    12-09-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: Disable delete sheet in Excel 2010

    Thanks Mike,
    I copied your code and pasted it into the This Workbook module but it didn't make any difference. I still get the right click menu.
    What am I missing? Do I need to change the arguments in the brackets in the subroutine?
    Regards,
    Steve

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Disable delete sheet in Excel 2010

    I misread the requirements. The code I posted disables right clicking on a cell, not on a sheet tab.

+ 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. Excel 2007 : Disable (Warning) Sound In Excel 2010
    By :) Sixthsense :) in forum Excel General
    Replies: 3
    Last Post: 03-07-2017, 02:22 PM
  2. Excel 2010 Prevent Delete Sheet
    By nick.lamps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2014, 10:03 PM
  3. when protect the sheet, delete and shift up is disable
    By nasim12w in forum Excel General
    Replies: 2
    Last Post: 08-08-2013, 03:38 PM
  4. VBA to disable only Paste in excel 2010
    By sonofearth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2012, 10:10 AM
  5. Disable Hyperlink Warning in Excel 2010
    By mubashir aziz in forum Excel General
    Replies: 6
    Last Post: 07-16-2012, 03:00 AM

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