Share via


Issue: Change in behavior from Office 2007 RTM to SP2 when Sheet.Unprotect is called

Let’s say you have a password protected Excel workbook, and you are calling following function through VBA in it:

   Sheet.Unprotect Password:=""

If you run this macro in Office 2007 RTM or SP1 version, it will result in a VBA Error; provided the actual password is not an empty string. However, in SP2 it will result in a password input dialog box.

This change of behavior is the result of a design change for SP2 release.

In case you have a code/logic which depends on the handling of VBA Error received in Office 2007 RTM/SP1 for wrong password specified for the above call, you can get the same behavior in SP2 release by passing a dummy password instead of an empty string. 

For example:

   Sheet.Unprotect Password:="dummy"

If the specified string is the correct password then the Sheet will be unprotected without any error or showing the Password input dialog box.