Password Property

Applies To

Document object.

Description

Sets a password that must be supplied to open the specified document. Write-only String.

See Also

HasPassword property, WritePassword 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