Password Property Example

This example opens Earnings.doc, sets a password for it, and then closes the document.

Set myDoc = Documents _
    .Open(FileName:="C:\My Documents\Earnings.doc")
myDoc.Password = "why"
myDoc.Close