Share via


ProtectedViewWindows.Open Method

Opens the specified workbook in a new Protected View window.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Open ( _
    Filename As String, _
    Password As Object, _
    AddToMru As Object, _
    RepairMode As Object _
) As ProtectedViewWindow
'Usage
Dim instance As ProtectedViewWindows
Dim Filename As String
Dim Password As Object
Dim AddToMru As Object
Dim RepairMode As Object
Dim returnValue As ProtectedViewWindow

returnValue = instance.Open(Filename, _
    Password, AddToMru, RepairMode)
ProtectedViewWindow Open(
    string Filename,
    Object Password,
    Object AddToMru,
    Object RepairMode
)

Parameters

  • Filename
    Type: System.String

    The name of the workbook (paths are accepted).

  • Password
    Type: System.Object

    The password for opening the workbook.

  • AddToMru
    Type: System.Object

    true to add the file name to the list of recently used files on the Recent tab of the Backstage view.

  • RepairMode
    Type: System.Object

    true to repair the workbook to prevent file corruption.

Return Value

Type: Microsoft.Office.Interop.Excel.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 your code.

See Also

Reference

ProtectedViewWindows Interface

ProtectedViewWindows Members

Microsoft.Office.Interop.Excel Namespace