Skip to main content

Application.Workbooks property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

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


This example activates the workbook Book1.xlsx.


This example opens the workbook Large.xlsx.

Workbooks.Open filename:="LARGE.XLSX"

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

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>