+ Reply to Thread
Results 1 to 7 of 7

Toggle Disable Insert New Work Sheet

  1. #1
    Registered User
    Join Date
    07-12-2021
    Location
    Australia
    MS-Off Ver
    Office 365
    Posts
    8

    Toggle Disable Insert New Work Sheet

    Hello,

    I am looking to disable the Insert new Worksheet button at the bottom of the screen. I found this post online:

    ... paste the following procedure into the large white area that is the workbook module:

    Code:
    Please Login or Register  to view this content.
    Next, while you are there in the Visual Basic Editor, from the menu bar at the top, click Insert > Module and paste this into that new module:

    Code:
    Please Login or Register  to view this content.

    This worked perfectly, however I need to be able to toggle this feature off so I am able to add new sheets when required... Is there an easy way to do this or another string of code I can use to achieve the result I am looking for?

    Thanks in advance,

    Greg
    Last edited by davesexcel; 07-16-2021 at 08:40 AM.

  2. #2
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Toggle Disable Insert New Work Sheet

    You could put a checkbox in a sheet and change your code to this;

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Toggle Disable Insert New Work Sheet

    It is definitely safer to use workbook protection. It does require a bit more code work though. Example, in the attachment, with three basic macros to handle. If you manually unprotect the file, the BeforeSave event will remember to protect it when saving the file.

    Artik
    Attached Files Attached Files

  4. #4
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Toggle Disable Insert New Work Sheet

    It's always a good discussion when talking about Excel 'security'.

    Just wondering why you think a macro with a hard coded password is "definitely safer" than the macro the OP put up?

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Toggle Disable Insert New Work Sheet

    One of the reasons is that the user has refused to allow macros to run when the file is opened.
    It has long been known that "security" in Excel is a delusion.


    Artik

  6. #6
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Toggle Disable Insert New Work Sheet

    Of course it is, that is why I was surprised you mentioned it was 'definitely safer'.

    By the way, you can stop the user disabling macros (well, make it harder at least).

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Toggle Disable Insert New Work Sheet

    Leaving aside the issue of securing the VBA code, I think a better solution is to protect the workbook. When macros are disabled, at least the structure of the workbook will still be protected. And that's what I meant by "definitely safer".

    Artik

+ 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. code to toggle (enable/disable) a specific Worksheet_SelectionChange macro
    By kittrell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2021, 03:54 PM
  2. Replies: 1
    Last Post: 06-17-2020, 09:51 AM
  3. [SOLVED] disable right click on sheet delete/insert sheet in excel
    By rana19 in forum Excel General
    Replies: 7
    Last Post: 10-08-2015, 05:16 AM
  4. Enable & disable conditional formatting using toggle button
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2015, 01:50 PM
  5. [SOLVED] Disable Insert Sheet function - NOT Working
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-03-2014, 06:27 AM
  6. [SOLVED] VBA Hide/Unhide row in work sheet if value in column H = "Y" w/ a toggle button
    By ywang in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2013, 01:02 AM
  7. Disable Insert Column without protecting sheet.
    By Steven in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2006, 01:35 PM

Tags for this Thread

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