Skip to Main Content
Excel® 2007 VBA Programmer's Reference
book

Excel® 2007 VBA Programmer's Reference

by John Green, Stephen Bullen, Rob Bovey, Michael Alexander
March 2007
Intermediate to advanced content levelIntermediate to advanced
1173 pages
26h 1m
English
Wrox
Content preview from Excel® 2007 VBA Programmer's Reference

Chapter 2. The Application Object

This chapter examines a range of Excel functionality, looking at features that are not necessarily related to each other. In general, the Excel object model contains objects designed to address quite specific tasks. The Application object sits at the top of the Excel object model hierarchy and contains all the other objects in Excel. It also acts as a catch-all area for properties and methods that do not fall neatly into any other object, but are necessary for programmatic control of Excel. There are Application properties that control screen updating and toggle alert messages, for example. There is an Application method that calculates the formulas in the open workbooks.

Globals

Many of the Application object's methods and properties are also members of <globals>, which can be found at the top of the list of classes in the Object Browser, as shown in Figure 2-1.

If a property or method is in <globals>, you can refer to that property or method without a preceding reference to an object. For example, the following two references are equivalent:

Application.ActiveCell
ActiveCell

However, you do need to be careful. It is easy to assume that frequently used Application object properties, such as ScreenUpdating, are <globals> when they are not. The following code is correct:

Application.ScreenUpdating = False

You will get unexpected results with the following:

ScreenUpdating = False

This code sets up a new variable and assigns the value False to it. You can easily ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 Power Programming with VBA

Excel® 2007 Power Programming with VBA

John Walkenbach
Microsoft® Office Excel 2003 Programming Inside Out

Microsoft® Office Excel 2003 Programming Inside Out

Curtis Frye, Wayne S. Freeze, Felicia K. Buckingham

Publisher Resources

ISBN: 9780470046432Purchase book