Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.71 KB

Excel.Application.Workbooks.md

File metadata and controls

63 lines (39 loc) · 1.71 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.Workbooks property (Excel)
vbaxl10.chm183115
vbaxl10.chm183115
Excel.Application.Workbooks
5291a324-87d7-3916-ffee-34c3389cea13
04/05/2019
medium

Application.Workbooks property (Excel)

Returns a Workbooks collection that represents all the open workbooks. Read-only.

Syntax

expression.Workbooks

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using Application.Workbooks.

The collection returned by the Workbooks property doesn't include open add-ins, which are a special kind of hidden workbook. You can, however, return a single open add-in if you know the file name. For example, Workbooks("Oscar.xla") returns the open add-in named "Oscar.xla" as a Workbook object.

Note

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.

Example

This example activates the workbook Book1.xls.

Workbooks("BOOK1").Activate

This example opens the workbook Large.xls.

Workbooks.Open filename:="LARGE.XLS"

This example saves changes to and closes all workbooks except the one that's running the example.

For Each w In Workbooks 
    If w.Name <> ThisWorkbook.Name Then 
        w.Close savechanges:=True 
    End If 
Next w

[!includeSupport and feedback]