ProtectedViewWindow interface

Office 2013 and later

Represents a Protected View window.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

public interface ProtectedViewWindow

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

  1. Files opened from the Internet.

  2. Attachments opened from Microsoft Outlook 2010.

  3. Files blocked by File Block Policy.

  4. Files that fail Office File Validation.

  5. 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.

To return a single ProtectedViewWindow object from the ProtectedViewWindows collection, use ProtectedViewWindows(Index), where Index is the index number of the window 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 you can perform by using a Workbook object returned by a ProtectedViewWindow object will be limited. Most operations that are not allowed will return "Run-time error 1004: This command is not available when Excel is sandboxed."