Excel4v/Excel12v

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Call an internal Microsoft Office Excel worksheet function, macro sheet function or command, or XLL-only special function or command, from within a DLL/XLL or code resource.

All recent versions of Excel support Excel4v. Only Excel 2007 and later versions support Excel12v.

These functions can only be called when Excel has passed control to the DLL/XLL. They can also be called when Excel has passed control indirectly via a call to Visual Basic for Applications (VBA). They cannot be called at any other time. For example, they cannot be called during calls to DllMain or other times when the operating system has called the DLL, or from a thread created by the DLL.

Excel4 and Excel12 accept their arguments as a variable length list on the stack, whereas these functions accept their arguments as an array. In all other respects, Excel4 behaves the same as Excel4v, and Excel12 behaves the same as Excel12v.

int _cdecl Excel4v(int iFunction, LPXLOPER pxRes, int iCount,
LPXLOPER rgx[]);
int _cdecl Excel12v(int iFunction, LPXLOPER12 pxRes, int iCount,
LPXLOPER12 rgx[]);

Parameters

iFunction (int)

A number indicating the command, function, or special function you want to call. For a list of valid iFunction values, see the following "Remarks" section.

pxRes (LPXLOPER or LPXLOPER12)

A pointer to an XLOPER (in the case of Excel4) or an XLOPER12 (in the case of Excel12) that will hold the result of the evaluated function.

iCount (int)

The number of subsequent arguments that will be passed to the function. In versions of Excel up to 2003 this can be any number from 0 to 30. In Excel 2007, this can be any number from 0 to 255.

rgx (LPXLOPER [] or LPXLOPER12 [])

An array containing the arguments to the function. All arguments in the array must be pointers to XLOPERs or XLOPER12s)

Property Value/Return Value

These functions return the same values as Excel4 and Excel12.

Remarks

These functions are useful where the number of arguments that might be passed by a given piece of code is variable. For example, it is useful when registering functions using xlfRegister where the number of total arguments depends on the number of arguments taken by the function being registered. It also useful where you are writing a wrapper function for one of Excel4 or Excel12. In these cases, you need to convert a variable argument list, as would normally be supplied to Excel4 or Excel12, to a single array argument of variable size in order to call back into Excel using Excel4v or Excel12v.

Example

See the code for the Excel and Excel12f functions in SAMPLES\FRAMEWRK\FRAMEWRK.C.

See Also

Reference

Excel4/Excel12

Excel4/Excel12