Calls a user-defined function. This function allows you to call macro language functions from DLLs.
Returns the return value from the user-defined function.
Excel4(xlUDF, LPXLOPER pxRes, int iCount, LPXLOPER pxRef,
LPXLOPER pxArg1, ...);
pxRef (xltypeRef or xltypeSRef)
The reference of the function you want to call. If it is named, you can use xlfEvaluate to look up the name first.
pxArg1, ...
Zero or more arguments to the user-defined function.
The following example runs TestMacro on sheet Macro1 in BOOK1.XLS. Make sure that the macro is on a sheet named Macro1.
\SAMPLES\EXAMPLE\EXAMPLE.C
short WINAPI xlUDFExample(void)
{
XLOPER xMacroName, xMacroRef, xRes;
xMacroName.xltype = xltypeStr;
xMacroName.val.str = "\033[BOOK1.XLS]Macro1!TestMacro";
Excel4(xlfEvaluate, &xMacroRef, 1,
(LPXLOPER)&xMacroName);
Excel4(xlUDF, &xRes, 1, (LPXLOPER)&xMacroRef);
return 1;
}