Whilst being OK for the occassional macro, VBA has its limits for full projects. The syntax is more limited than that of VB and I've found stability problems with Excel VBA. However, Excel is a very useful data storage medium and the Excel classes were designed to allow this use from within a VB based application.
There are two classes, ExcelApplication and ExcelWorkbook.ExcelApplication
This opens Excel if necessary and creates a collection for ExcelWorkbook objects. Ony one ExcelApplication object can exist at a time.ExcelWorkbook
This allows workbooks to be opened and manipulated. Books are defined as 'With Events' so that use can be made of Excel events.
The class has the following methods and properties.METHODS
|Opens the specified book.
|Clears the contents of the current sheet.
|Saves the open book.
|Closes the open book.
|Returns a reference to the open book object.
|Returns the name of the active sheet.
|Returns a reference to the active sheet.
|Selects the sheet and returns a reference to it.
|Returns a reference to the specified sheet object WITHOUT selecting it.
|Sheet name, (r1, c1), (r2, c2)
|Returns a reference to the defined range on the specified sheet WITHOUT selecting it.
The class contains a procedure for only one event, 'xlBk_SheetActivate', which calls a main program procedure, 'select_sheet_action', whenever a new sheet is selected. However, it is easy to add code for other events using these as templates.