Using the C API and Visual Basic

When you call a DLL function from Visual Basic in Microsoft Excel, the DLL function can use the Microsoft Excel Applications Programming Interface (C API) functions to call back into Microsoft Excel. You cannot use the C API across processes. The DLL using the C API must be called from Visual Basic running in Microsoft Excel (a DLL called from Microsoft Project or Microsoft Visual Basic or another Microsoft Office application cannot call the C API). In addition, the C API can be called only after Microsoft Excel has called the DLL. This qualification is met when Visual Basic in Microsoft Excel calls the DLL, and the DLL in turn calls the C API. When the DLL function is called by an external event (such as a DDE command from another application or a Windows timer), the DLL function cannot call the C API.

For more information about using the C API, see Chapter 7, "The Microsoft Excel Applications Programming Interface" and Chapter 8, "Applications Programming Interface Function Reference."