This documentation is archived and is not being maintained.

Application.Workbooks Property

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



expression   A variable that represents an Application object.


Using this property without an object qualifier is equivalent to using

Visual Basic for Applications

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,

Visual Basic for Applications
will return the open add-in named "Oscar.xla" as a Workbook object.


This example activates the workbook Book1.xls.

Visual Basic for Applications

This example opens the workbook Large.xls.

Visual Basic for Applications
Workbooks.Open filename:="LARGE.XLS"

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

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