Skip to content

Latest commit

 

History

History
73 lines (51 loc) · 3.37 KB

Excel.ProtectedViewWindow.md

File metadata and controls

73 lines (51 loc) · 3.37 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ProtectedViewWindow object (Excel)
vbaxl10.chm914072
vbaxl10.chm914072
Excel.ProtectedViewWindow
6a32240c-c90b-c51a-6f8e-c3ff496b9855
03/30/2019
medium

ProtectedViewWindow object (Excel)

Represents a Protected View window.

Remarks

A Protected View window is used to display a workbook from a potentially unsafe location. Unsafe locations are defined as the following:

  • Files opened from the Internet.
  • Attachments opened from Outlook.
  • Files blocked by File Block Policy.
  • Files that fail Office file validation.
  • Files explicitly opened in Protected View by using the Open in Protected View command of the Open button in the Open dialog box.

Workbooks displayed in a Protected View window cannot be edited and are restricted from running active content such as Visual Basic for Applications macros and data connections. For more information about Protected View windows, see What is Protected View?

To return a single ProtectedViewWindow object from the ProtectedViewWindows collection, use ProtectedViewWindows (index), where index is the index number of the window that you want to open.

You can also access the ProtectedViewWindow object that represents the active Protected View window by using the ActiveProtectedViewWindow property of the Application object.

After you access a ProtectedViewWindow object, use the Workbook property to access the Workbook object that represents the workbook file that is open in the Protected View window. Because a Protected View window is designed to protect the user from potentially malicious code, the operations that you can perform by using a Workbook object returned by a ProtectedViewWindow object will be limited. Operations that are not allowed will return an error.

Example

The following code example accesses the Workbook object that represents the workbook that is open in the first Protected View window.

Dim wbProtected As Workbook 
 
If Application.ProtectedViewWindows.Count > 0 Then 
    Set wbProtected = Application.ProtectedViewWindows(1).Workbook 
End If 

Methods

Properties

See also

[!includeSupport and feedback]