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

Definition

Opens the specified workbook in a new Protected View window.

public Microsoft.Office.Interop.Excel.ProtectedViewWindow Open (string Filename, object Password, object AddToMru, object RepairMode);
Public Function Open (Filename As String, Optional Password As Object, Optional AddToMru As Object, Optional RepairMode As Object) As ProtectedViewWindow

Parameters

Filename
String

The name of the workbook (paths are accepted).

Password
Object

The password for opening the workbook.

AddToMru
Object

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

RepairMode
Object

true to repair the workbook to prevent file corruption.

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

Applies to