Password Property [Excel 2003 VBA Language Reference]
Returns or sets the password that must be supplied to open the specified workbook. Read/write String.
Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.
expression.Password
expression Required. An expression that returns one of the objects in the Applies To list.
Example
In this example, Microsoft Excel opens a workbook named Password.xls, sets a password for it, and then closes the workbook. This example assumes a file named "Password.xls" exists on the C:\ drive.
Sub UsePassword()
Dim wkbOne As Workbook
Set wkbOne = Application.Workbooks.Open("C:\Password.xls")
wkbOne.Password = InputBox ("Enter Password")
wkbOne.Close
End Sub
Note The Password property is readable and returns ">>**".
Applies to | Workbook Object