Skip to main content

ProtectedViewWindows.Open method

Opens the specified workbook in a new Protected View window.

Syntax

expression.Open (FileNamePasswordAddToMruRepairMode)

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"

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>