Sending Data to Excel

Once you have a reference to the Excel application, you need to get a reference to the Workbooks collection object.

Dim xlObjBooks As Excel.Workbooks
Set xlObjBooks = excelApp.Workbooks

With that accomplished, you need to get a reference to the Workbook object. This will differ depending upon if Excel is already running or if you launched a new instance. If Excel is already running, you can get a reference to the Workbook object by naming the workbook as in

Dim xlObjBook As Excel.Workbook
Set xlObjBook = xlObjBooks. Item("TestCase.XLS")

or you can get a reference to the Workbook object by referencing the workbook by its index as in

Dim xlObjBook As Excel.Workbook
Set xlObjBook = xlObjBooks. Item(1)

If Excel is not ...

Get Professional Development with Visio® 2000 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.