XL98: Worksheet Protection May Be Removed Without a Password

Last reviewed: April 6, 1998
Article ID: Q183504
The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition

SYMPTOMS

When you protect a worksheet and type a password in the Protect Sheet dialog box, you can disable the protection programmatically without using the password.

CAUSE

You can remove the password protection on a worksheet programmatically when both of the following conditions are true:

  • When you protect the worksheet, either programmatically or manually, you fail to select all three protection options (Contents, Objects, and Scenarios) in the Protect Sheet dialog box.

        -and-
    
  • You run a macro that contains the ActiveSheet.Unprotect statement.

RESOLUTION

To resolve this problem, select all three protection options when you protect a particular worksheet.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/default.asp

The following sample macro removes worksheet protection when you do not select all the worksheet protection options:

   Sub Test()
       ActiveSheet.Protect
       ActiveSheet.Unprotect
   End Sub

Instead of removing protection on a worksheet, you may decide to change the password. Assuming you protect a worksheet with a password, and you do not select one or more of the protection options, you can change the protection password for the worksheet with the following macro:

   Sub Test2()
       ActiveSheet.Protect password:="<new password>"
   End Sub


Additional query words: XL98
Keywords : kbprg xlvbahowto xlvbainfo OffVBA
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbbug
Solution Type : kbpending


Last reviewed: April 6, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.