+ Reply to Thread
Results 1 to 6 of 6

Disable adding sheet, except from macro

  1. #1
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Disable adding sheet, except from macro

    Hi

    I want to dis-allow users to add sheets to my file manually, so I wrote following code:-

    Please Login or Register  to view this content.
    But, this disables adding sheet by my macro code as well.

    Is there a way to disable adding sheet manually from menu options, but allow macro to add sheets?

    tia
    Ajay
    Last edited by ajaykgarg; 04-07-2011 at 12:25 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Disable adding sheet, except from macro

    In your OTHER macros, disable the triggering of "events" while your macro is running, then turn events back on.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 04-06-2011 at 06:44 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Disable adding sheet, except from macro

    Try this
    Please Login or Register  to view this content.
    Hope this helps

    [EDIT]
    Never saw your post Jerry, sorry about that.
    Attached Files Attached Files
    Last edited by Marcol; 04-06-2011 at 01:42 AM. Reason: Apologies late post
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Disable adding sheet, except from macro

    Why not just protect the workbook?
    Please Login or Register  to view this content.
    Using inbuilt protection will work even if macros aren't enabled
    Last edited by royUK; 04-06-2011 at 02:03 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: Disable adding sheet, except from macro

    Jerry and Marcol - That works. Thanks.

    Roy - I don't want to protect the workbook, as I want to let users add columns, etc, but not sheets.

    Closing the thread. Thanks.

    Ajay

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Disable adding sheet, except from macro

    Hello ajaykgarg:
    Are you aware that excel 2007 has specfic feature to protect/prevent "structural changes" . Structural changes include the addition, deletion, movement, hiding or unhiding of worksheets within a workbook. Your solution is easily defeated by not activating macros in the first place ... while this solution requires no activation of macros and needs a password.

    To protect a workbook from these kinds of changes, click Review > Changes > Protect Workbook > Protect Structure and Windows. In the Protect Structure and Windows dialog box ensure that Structure is checked and assign a password if required. Similar steps need to be followed when unprotecting the workbook’s structure: click Review > Changes > Protect Workbook > Protect Structure and Windows. You will need to enter a password if a password was previously assigned.

    http://www.msexcel07.com/protecting-workbooks.htm


    ADDING NEW SHEET
    Please Login or Register  to view this content.
    Last edited by nimrod; 04-07-2011 at 01:13 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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