This documentation is archived and is not being maintained.

ProtectedViewWindow.Workbook Property (Excel)

Returns an object that represents the workbook that is open in the specified Protected View window. Read-only

Version Added: Excel 2010

expression .Workbook

expression A variable that represents a ProtectedViewWindow object.

Return Value

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 the Workbook method will be limited. Any operation that is not allowed will return an error.

A workbook displayed in a protected view window is not a member of the Workbooks collection. Instead, use the Workbook property of the ProtectedViewWindow object to access a workbook that is displayed in a protected view window.

The following example uses the Workbook property to return 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