ProtectedViewWindows.Open Method (Excel)
Opens the specified workbook in a new Protected View window.
Version Information
Version Added: Excel 2010
Syntax
expression .Open(Filename, Password, AddToMru, RepairMode)
expression A variable that represents a ProtectedViewWindows object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Filename |
Required |
String |
The name of the workbook (paths are accepted). |
Password |
Optional |
Variant |
The password for opening the workbook. |
AddToMru |
Optional |
Variant |
True to add the file name to the list of recently used files on the Recent tab of the Backstage view. |
RepairMode |
Optional |
Variant |
True to repair the workbook to prevent file corruption. |
Return Value
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 workbook in a new Protected View window.
ProtectedViewWindows.Open FileName:="C:\MyFiles\MyWorkbook.xls"