Share via


ProtectedViewWindows.Open Method (Word)

Opens the specified document in a new protected view window.

Version Information

Version Added: Word 2010

Syntax

expression .Open(FileName, AddToRecentFiles, PasswordDocument, Visible, OpenAndRepair)

expression An expression that returns a ProtectedViewWindows object.

Parameters

Name

Required/Optional

Data Type

Description

FileName

Required

Variant

The name of the document (paths are accepted).

AddToRecentFiles

Optional

Variant

True to add the file name to the list of recently used files at the bottom of the File menu.

PasswordDocument

Optional

Variant

The password for opening the document.

Visible

Optional

Variant

True if the document is opened in a visible window. The default value is True.

OpenAndRepair

Optional

Variant

True to repair the document to prevent document corruption.

Return Value

ProtectedViewWindow

Remarks

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.

Example

The following code example opens a document in a new protected view window.

ProtectedViewWindows.Open FileName:="C:\MyFiles\MyDoc.doc" 

See Also

Concepts

ProtectedViewWindows Object Members

ProtectedViewWindows Object