+ Reply to Thread
Results 1 to 5 of 5

VBA Password Protection

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Password Protection

    Hi, I wonder whether someone may be able to help me please.

    I'm trying to add some worksheet protection to my script which allows a 'On Opne' script to run then prevents the user from making any change to the spreadsheet

    This is very simple script I've put together, but for some reason, the sheet is not being protected at the end of the script.

    Please Login or Register  to view this content.
    I've also tried:

    Please Login or Register  to view this content.
    which does protect the sheet, but doesn't the rest of my script to run.

    I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.

    Many thanks and kind regards

    Chris
    Last edited by hobbiton73; 05-26-2015 at 06:05 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA Password Protection

    Not seeing
    'Rest of script
    it's just guessing
    but:
    which sheet is activesheet
    does it change during the rest of the script
    do you open other workbooks in the rest of the script
    is there some error handling in the rest of the script
    is there exit sub?
    etc.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Password Protection

    Hi @Kaper thank you for taking the time to reply to my post.

    Please find below the script in full:

    Please Login or Register  to view this content.
    As you can see, there is an 'Exit sub' so I can understand why my first example of the sheet protection failed but not the second.

    Many thanks and kind regards

  4. #4
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Password Protection

    Hi @Kaper, I just wanted to let you know that I've managed to get this to work, and for those of you who might be intrested here is the code:

    Please Login or Register  to view this content.
    Many thanks and kind regards

    Chris

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA Password Protection

    Good to hear that, and thanks for sharing the solution

+ 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. [SOLVED] Password Protection Formula - Remembering I already entered the Password!
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-10-2014, 01:35 PM
  2. Password Protection not accepting password
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-20-2014, 07:00 AM
  3. password protection-is there anyway to put a password on running a macro in excel?
    By Solarissf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2008, 10:06 AM
  4. [SOLVED] Password Protection
    By sitay1 in forum Excel General
    Replies: 1
    Last Post: 08-25-2005, 11:05 PM
  5. Password Protection
    By Tom in forum Excel General
    Replies: 2
    Last Post: 06-23-2005, 09:05 PM

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