This chapter describes the Applications Programming Interface (API) for Microsoft Excel. You can use the API to develop programs that call Microsoft Excel.
The first part of this chapter discusses writing DLL functions and calling them from a Microsoft Excel worksheet. For information about using DLL functions with Visual Basic, see, "Using DLLs from Visual Basic." The second part of this chapter, "Calling Microsoft Excel from C," discusses the API calls that allow a C-language application to call into Microsoft Excel.
Microsoft Excel exposes its objects as OLE Automation objects. OLE 2 allows another application, called an OLE Automation Controller, to access the exposed objects and use their properties and methods. For more information about using the Microsoft Excel OLE Automation interface, see, "Using the OLE Automation Interface."
Depending on your application, you may wish to use the C API, a DLL called from Visual Basic, the OLE Automation interface, or some hybrid combination. The introduction to this book discusses when each of these solutions is most appropriate and gives guidelines for selecting an approach best suited to your application.
Microsoft Excel 97 has two macro languages: the Microsoft Excel 4.0 macro language and Visual Basic for Applications. Throughout this chapter, we use the term "macro language" to mean the Microsoft Excel 4.0 macro language.