September 2001
Beginner
528 pages
11h 59m
English
If your VBA code is running within Excel, then the Excel application object is automatically available to you by using the Application keyword. Thus, you could write
Workbooks.Add
The implicit reference causes the “Workbooks” keyword to automatically apply to the Excel.Application object.
If you are automating Excel from another Office application, you must explicitly create an instance of Excel and use a reference to that instance to access the Application object. For example, the following code could be run from any other Office application to start a hidden copy of Excel, create a new workbook, and put the value 12 in cell A1 of Sheet1:
Dim MyXLApp As Excel.Application Set MyXLApp = New Excel.Application MyXLApp.Workbooks.Add ...
Read now
Unlock full access