Skip to main content

Application object

Table of contents
  1. Remarks
  2. Examples

Represents the entire Microsoft Excel application.

Remarks

The Application object contains:

  • Application-wide settings and options.
  • Methods that return top-level objects, such as ActiveCell, ActiveSheet, and so on.

Examples

Use the Application property to return the Application object. The following example applies the Windows property to the Application object.

Application.Windows("book1.xls").Activate

The following example creates an Excel workbook object in another application and then opens a workbook in Excel.

Set xl = CreateObject("Excel.Sheet")
xl.Application.Workbooks.Open "newbook.xls"

Many of the properties and methods that return the most common user-interface objects, such as the active cell (ActiveCell property), can be used without the Application object qualifier. For example, instead of writing:

Application.ActiveCell.Font.Bold = True

You can write:

ActiveCell.Font.Bold = True

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>