The Global Object
As mentioned earlier in this chapter, Excel provides shortcuts into its object hierarchy through properties like ActiveCell and the Sheets collection. Those shortcuts are actually members
of the Global object, which is a sort of default object that Excel uses if you omit an object name. This allows you to write code like:
ActiveCell = 42
rather than:
Application.ActiveCell = 42
The Global object includes many of the same members as the Application object, as shown in this list:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Many of these members return objects or collections, so they look like absolute references. In reality, they are all members of the Global object (even Application is a property of the Global object). In short, the Global object is the granddaddy of all the Excel objects.
You don’t have to understand the Global object to use Excel’s object library, ...
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.
Read now
Unlock full access