Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.sdk
external usenet poster
 
Posts: 9
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
xlUDF [email protected] Excel Programming 0 May 4th 06 02:57 PM
Calling a Sub from another shashi1515[_4_] Excel Programming 5 February 4th 06 03:57 AM
Need Help using/calling a DLL Trip[_3_] Excel Programming 1 January 9th 06 01:36 PM
Calling an Add-In BillCPA Excel Discussion (Misc queries) 2 August 11th 05 09:32 PM
Calling SUB Peter Longstaff Excel Programming 2 February 23rd 04 08:04 PM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"