Password Property
Returns or sets the password that must be supplied to open the specified workbook. Read/write String.
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 = "secret"
wkbOne.Close
End Sub
Note The Password property is readable and returns "********".