Notes
After you retrieve the password with this macro,
you may want to open the form in design mode – entering the password
in the prompt that appears – and remove the password protection
completely. On the (Properties) page, clear the Protect form
design box to remove the password protection. You can also set a
new password with the Set Password button.
If you don't have Outlook 2000 or later, you can use this
code in a Visual Basic or a VBA project in Word. Just remember to add a
reference to the Outlook library.
If
the password was entered with non-printing
characters, the MsgBox will show a number of
squares like this instead
of the password text. You can still retrieve
the password with this additional code:
strPassword = objFD.Password
intLen = Len(strPassword)
For i = 1 To intLen
Debug.Print Asc(Mid(strPassword, i, 1))
Next
You might need to use SendKeys to enter
such non-printing characters in the form's
password dialog.
To
set a password that's more secure, you can
set up Office to support an additional
non-ASCII language, such as Russian. Enter
the password with the other language turned
on. If the password is entered in that
fashion, both the code samples above will
return only ???? for a four-character
password. You will, of course, need to
switch to that other language before
entering the password to get into form
design mode.
As
you may have gathered from this article, the
form password protection in Outlook doesn't
amount to much. It's hardly surprising,
then, that Microsoft has removed form
password support in Outlook 2007. |