The Excel4 function is used to call any of the Microsoft Excel functions or command equivalents. These function or command equivalents are the same as those defined in the online Microsoft Excel Online Function Reference. The Microsoft Excel Online Function Reference can be obtained from http://www.microsoft.com.
Of course, many functions in the Microsoft Excel XLM language do not make sense in DLLs. For example, you would never want to call the GOTO function or the ARGUMENT function from a DLL because its behavior wouldn't make sense outside of an XLM macro sheet.
To understand how to specify a function, you need to know something about how Microsoft Excel works internally. Microsoft Excel contains two tables: the function table and the command-equivalent table. These tables are simply arrays of pointers to internal Microsoft Excel functions.
The command-equivalent table is equivalent to the function table, with entries that point to Microsoft Excel command equivalents. When you use Excel4, you will need to know the index of the Microsoft Excel function or command equivalent. These are defined for you in XLCALL.H:
#define xlfCount 0
#define xlfIsna 2
#define xlfIserror 3
#define xlfSum 4
#define xlfAverage 5
#define xlfMin 6
#define xlfMax 7
#define xlfRow 8
#define xlfColumn 9
#define xlfNa 10
.
.
.
#define xlcBeep (0 | xlCommand)
#define xlcOpen (1 | xlCommand)
#define xlcOpenLinks (2 | xlCommand)
#define xlcCloseAll (3 | xlCommand)
#define xlcSave (4 | xlCommand)
#define xlcSaveAs (5 | xlCommand)
#define xlcFileDelete (6 | xlCommand)
#define xlcPageSetup (7 | xlCommand)
#define xlcPrint (8 | xlCommand)
#define xlcPrinterSetup (9 | xlCommand)
.
.
.
The name of each function or command equivalent is based on the name in the Microsoft Excel Online Function Reference. Functions are prefixed with "xlf," while command equivalents are prefixed with "xlc." You will also notice that all the command equivalents have their xlCommand bit set, so Microsoft Excel knows whether to use the command-equivalent table or the function table. You can also easily determine whether you have a function or a command equivalent. It is important to distinguish between the two: a function returns a value, and a command equivalent executes some action.