+ Reply to Thread
Results 1 to 3 of 3

"IF" sheet is protected with password

  1. #1
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    "IF" sheet is protected with password

    I'm always running into something.

    Started using the new Auto Filter macro on purchase order responses this morning, and ran into an issue I hadn't considered.

    The template I sent the suppliers is password protected, to keep them from altering the formulas. Most suppliers are 'dumping' the inforrmation into a copy fo this template, and the copy is NOT password protected, BUT.... not all of them.

    I've run into examples this morning that were no protected at all, were protected, but not with a password, and were password protected with the original password, 'password'. (I know, but it's light security.)

    Now I need to add lines at the beginning of my code to meet each of those possibilities.

    If it's no protected, no biggie, ActiveSheet.Unprotect still won't return an error. If it's not password protected, ActiveSheet.Unprotect will unprotect it, but if it is password protected, how do I get a macro to enter the password, 'password', only if it needs to?

    Here is the top part of the macro, any help would be appreciated:

    Please Login or Register  to view this content.
    Thanks, and have a good one.

    Jerry

  2. #2
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    It has been my experience

    This has been my experience:

    If code attempts to unprotect a worksheet that has no protection, the routine proceeds without error, even if you supply a password.

    If code attempts to unprotect a worksheet that has protection, but no password, the routine proceeds without error, even if you supply a password.

    The only time I have encountered errors is when someone makes a copy without a password, but then protects with a new password.
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  3. #3
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Right again, DC

    You are correct once again, DC. All I had to do was add the password, and it works either way.

    I hope you'll have time to look at my other post regarding the first cell containing a number.

    Thanks, and have a good one.

+ 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