About this lesson
A visual view of a portion of Excel's object model.
There are no related exercise files for this lesson.
Excel's VBA Object Model
A (small) sample of Excel’s VBA object model
When to use
Where you need to find the object components that you wish to connect to and manipulate
Base summary of the Object Model chain
- Every application has one or more workbooks, which form part of the collection of objects in that application.
- Within each workbook, there are one or more worksheets.
- Within each worksheet are a number of ranges, such as:
- Individual cells
- Subsets of ranges
Locating Object Model Parts
There are (at least) 3 ways to locate appropriate components of the Object Model:
1) The Object Browser
- When in the Visual Basic Editor, you can open the Object Browser via either of the following methods:
- Click the Object Browser button on the top toolbar (looks like a cardboard box with coloured shapes above it), or
- Press F2.
- Narrow the browser field by selecting an area from the location drop-down menu at the top of the Object Browser.
- The search field allows you to look for properties, methods, and events that match what you ask for
- When you are typing code, Intellisense automatically lists valid objects/properties or methods when you type a period.
- Intellisense only appears if the code is valid; it does not work if there are syntax errors.
3) The Locals Window
- The Locals window also displays available “parts” when code is running
- This will be explored in more detail in the section on Advanced Debugging later in this course
Lesson notes are only available for subscribers.