ProtectedViewWindows.Open Method
Opens the specified document in a new protected view window.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
Syntax
'Declaration
Function Open ( _
ByRef FileName As Object, _
ByRef AddToRecentFiles As Object, _
ByRef PasswordDocument As Object, _
ByRef Visible As Object, _
ByRef OpenAndRepair As Object _
) As ProtectedViewWindow
'Usage
Dim instance As ProtectedViewWindows
Dim FileName As Object
Dim AddToRecentFiles As Object
Dim PasswordDocument As Object
Dim Visible As Object
Dim OpenAndRepair As Object
Dim returnValue As ProtectedViewWindow
returnValue = instance.Open(FileName, _
AddToRecentFiles, PasswordDocument, _
Visible, OpenAndRepair)
ProtectedViewWindow Open(
ref Object FileName,
ref Object AddToRecentFiles,
ref Object PasswordDocument,
ref Object Visible,
ref Object OpenAndRepair
)
Parameters
- FileName
Type: System.Object%
The name of the document (paths are accepted).
- AddToRecentFiles
Type: System.Object%
true to add the file name to the list of recently used files at the bottom of the File menu; otherwise, false.
- PasswordDocument
Type: System.Object%
The password for opening the document.
- Visible
Type: System.Object%
true if the document is opened in a visible window; otherwise, false. The default value is True.
- OpenAndRepair
Type: System.Object%
true to repair the document to prevent document corruption; otherwise, false.
Return Value
Type: Microsoft.Office.Interop.Word.ProtectedViewWindow
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.