Microsoft KB Archive/126092

{|
 * width="100%"|

XL5: Unprotect Method in VB for Applications Help Incorrect

 * }

-

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.00a 5.00c

Keywords : kbmacro kbprg kbdocerr

Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c; winnt:5.0

Platform : MACINTOSH WINDOWS winnt

Issue type : kbbug

Technology :