XL5: Unprotect Method in VB for Applications Help Incorrect

Last reviewed: February 2, 1998
Article ID: Q126092
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows NT, version 5.0

SYMPTOMS

In a Visual Basic, Applications Edition, macro, the Unprotect method will not prompt the user for a password when that user attempts to unprotect a workbook if the "password" argument is omitted.

This behavior is different from the information in the Microsoft Excel Help and in the "Excel 5 Visual Basic for Applications Reference" book published by Microsoft Press.

Microsoft Excel Help states the following about the "password" argument of the Unprotect method:

   If the argument is omitted and the workbook has a password, you will be
   prompted for the password.

This information is incorrect. When you use the Unprotect method to remove protection from a workbook and you do not use the "password" argument, if the workbook has a password, Microsoft Excel returns the error, "Incorrect Password" and does not remove the protection.

WORKAROUND

If the workbook is password protected, the "password" argument of the "Unprotect" method must be used and the correct password must be specified.

If a password is specified and the workbook is not password protected, the argument will be ignored and the workbook will be unprotected normally.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: 5.00 5.00a 5.00c
Keywords : kbmacro kbprg kbdocerr
Version : WINDOWS:5.0,5.0c; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbbug
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.