|Word Developer Reference|
expression A variable that represents a Document object.
Important Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see.
This example opens Earnings.doc, sets a password for it, and then closes the document.
|Visual Basic for Applications|