+ Reply to Thread
Results 1 to 3 of 3

Macro to protect workbook not working

  1. #1
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Macro to protect workbook not working

    Hello,

    I need protected workbook but I still need to add sheets into it. What I've tried so far, is that I protect workbook (you can't add sheet if workbook is protected), then I put these two lines into code.

    This one in the beginning
    ActiveWorkbook.Unprotect

    and this one at the end
    ActiveWorkbook.Protect


    Problem is everytime I run the code, protection goes off (?). What do I need to do that protection stays on when I add more sheets??

    This one's the code that adds sheet;

    Please Login or Register  to view this content.
    Last edited by Crüe; 09-05-2011 at 03:27 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Macro to protect workbook not working

    It would be nice to share your solution with the community ...

  3. #3
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Macro to protect workbook not working

    Sorry... I was modyfying it little..

    But i got it working, I put this line ActiveWorkbook.Protect under End If-statement

+ 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