Appendix A. Excel Object Model

For most of the programming tasks that you will do while integrating Excel and Access, Access VBA will automate Microsoft Excel. This makes understanding the Excel object model very important. I have broken down the key parts of the Excel object model that have been most useful to me in automation projects. This is not an all-inclusive list of properties and methods, but understanding this core will make the work much easier. See the Excel VBA help file to get more information on all the properties and methods.

Application Object

The Application object contains many properties and methods that can be very useful. In some cases, the collections of objects contained under the Application object also appear in the Workbook and Worksheet objects. When that is relevant, I'll note it in the text. In the examples shown, assume that the following code has already been entered in the VBA module from Access:

Dim xlapp as Excel.Application
Set xlapp = New Excel.Application

By doing this, the variable xlapp can be used to get the properties and methods discussed below.

Application Object Properties

The Application object's properties include a number of key pieces that provide your automation with a perspective on Excel, similar to the perspective users get through a GUI.

ActiveCell

This property is a range object that references the active cell in the application. If you have multiple workbooks open, and each has multiple worksheets, it refers to the active cell in the ...

Get Integrating Excel and Access now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.