ProtectedViewWindows.Open(Object, Object, Object, Object, Object) Method

Definition

Opens the specified document in a new protected view window.

public Microsoft.Office.Interop.Word.ProtectedViewWindow Open (ref object FileName, ref object AddToRecentFiles, ref object PasswordDocument, ref object Visible, ref object OpenAndRepair);
abstract member Open : obj * obj * obj * obj * obj -> Microsoft.Office.Interop.Word.ProtectedViewWindow
Public Function Open (ByRef FileName As Object, Optional ByRef AddToRecentFiles As Object, Optional ByRef PasswordDocument As Object, Optional ByRef Visible As Object, Optional ByRef OpenAndRepair As Object) As ProtectedViewWindow

Parameters

FileName
Object

The name of the document (paths are accepted).

AddToRecentFiles
Object

true to add the file name to the list of recently used files at the bottom of the File menu; otherwise, false.

PasswordDocument
Object

The password for opening the document.

Visible
Object

true if the document is opened in a visible window; otherwise, false. The default value is True.

OpenAndRepair
Object

true to repair the document to prevent document corruption; otherwise, false.

Returns

A ProtectedViewWindow object.

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 the code.

Applies to