편집

다음을 통해 공유


ProtectedViewWindows.Open method (Excel)

Opens the specified workbook in a new Protected View window.

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

ProtectedViewWindow

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" 

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.