+ Reply to Thread
Results 1 to 8 of 8

Disable adding a new tab/worksheet plus button

  1. #1
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    69

    Disable adding a new tab/worksheet plus button

    Hello, I created a floating form and, on this form, I have a button to create a new tab/worksheet from a hidden tab. How can I disable the "+" button to create a new tab/worksheet so the user has to use my button?

    Thanks,

  2. #2
    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: Disable adding a new tab/worksheet plus button

    You could protect the workbook, then have your code unprotect, add the sheet, then reprotect.
    Rory

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

    Re: Disable adding a new tab/worksheet plus button

    If you protect the structure of the workbook Review/Protect Workbook, the user will not be able to add a new sheet. On the other hand, you, in code, will have to programmatically remove the protection, insert a sheet from the "template" and put the workbook structure protection back on.

    Artik

  4. #4
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    69

    Re: Disable adding a new tab/worksheet plus button

    Ok thanks all, I'll give the protect/unprotect a try....

  5. #5
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    69

    Re: Disable adding a new tab/worksheet plus button

    Ok I protected the workbook and am using the lock unlock to create the tab which works great BUT it took away the delete so I added a delete button to my form and use the DeleteActiveWorksheet sub which it works great as well.
    The issue I have with the delete is I don't want it to never be able to delete a tab called "INFO" and a tab called "MAIN". how can I do that?

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

  6. #6
    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: Disable adding a new tab/worksheet plus button

    Change it to:

    Please Login or Register  to view this content.

  7. #7
    Banned User!
    Join Date
    03-11-2024
    Location
    usa
    MS-Off Ver
    CURRENT
    Posts
    23

    Re: Disable adding a new tab/worksheet plus button

    Open Visual Basic for Applications (VBA) by pressing Alt+F11.
    In the Project Explorer window, find your project and expand it.
    Find the "ThisWorkbook" object (or whatever object you have VBA code in).
    Double-click an object to open the code editor for that object.
    Paste the following code into the code editor:
    Private Sub Workbook_Open()
    Application.CommandBars("Worksheet Menu Bar").Controls("Sheet Tabs").Enabled = False
    End Sub
    This code will run every time the workbook is opened and disable the New Tab/Sheet Plus button.
    Save your changes and close the code editor.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Disable adding a new tab/worksheet plus button

    Quote Originally Posted by CarissaKirby View Post
    Paste the following code into the code editor:
    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however we recommend that you include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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 Right click on Macro Button in a worksheet
    By RAJRAJ85 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2017, 07:01 PM
  2. [SOLVED] Disable or hide a recorded macro button when clicked if the worksheet is protected
    By sai19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-31-2014, 12:14 PM
  3. How to disable save and print button in excel worksheet 2010
    By ChowYS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2012, 10:52 PM
  4. Disable Form button in excel worksheet
    By uvaidya in forum Excel General
    Replies: 0
    Last Post: 08-10-2012, 07:16 AM
  5. Protect a Worksheet (Disable Macro Button)
    By PRodgers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2009, 10:21 AM
  6. Disable Automatic Re-calculations and Adding a Button to do the Job
    By Aaron1978 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2007, 07:33 AM
  7. Disable the Close Window button of the worksheet
    By yangyh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-14-2005, 12:04 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