![]() |
calling xlfEvaluate/xlUDF in an xll
EOMONTH is an Analysis Toolpak function in Excel 2003 and became a built-in
function in Excel 2007. In Excel 2003 you must have loaded the ATP add-in in order to get the first method to work. In this case I would have thought this should work as you expected. Have you tried any of the other ATP functions, such as PRICE? All Toolpak functions were not defined in the old SDK's xlcall.h, but were added for EXcel 2007. It seems that EOMONTH was not added which looks like an oversight on the part of the Excel team. Have you tried running your 2nd method in Excel 2007? I'm afraid I don't have time to test these things out for you, but this might shed some light on the problem. Regards Steve Dalton "RK" wrote in message . .. I have written an xll that uses Excel4 to callback the Excel 2003 C API. The built-in Excel function I am interested in calling back is EOMONTH. Since Excel 2003 C API does not have an enumeration for this function (Excel 2007 C API does), I resorted to using xlUDF as follows: int result = 0; XLOPER argDate, argOffset, funcResult, funcName; argDate.xltype = xltypeNum; argDate.val.num = 39607; argOffset.xltype = xltypeNum; argOffset.val.num = 0; funcName.xltype = xltypeStr; funcName.val.str = "\007EOMONTH"; result = Excel4(xlUDF, &funcResult, 3, &funcName, &argDate, &argOffset); This works just fine. The Excel xll documentation mentions that one can use xlfEvaluate to get a reference to a function and use the reference instead of xlUDF which is supposedly slower. This is apparently true if the callback function is to be called repeatedly. My question: how can I make xlfEvaluate work? My attempts at getting a reference to EOMONTH using xlfEvaluate have failed. I have tried the following with no success: XLOPER funcName1; funcName1.xltype = xltypeStr; funcName1.val.str = "\010!EOMONTH"; result = Excel4(xlfEvaluate, &funcResult, 1, &funcName1); Excel4 returns 0 which means it thinks that it is doing something right but the funcResult.xltype code is 16 which is xltypeErr. I suspect that it has something to do with the way I have entered "!EOMONTH" or that xlfEvaluate works only with VBA macros, defined cell names, etc. Any help is appreciated. Thanks. |
All times are GMT +1. The time now is 10:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com