call one XLL from another XLL

Dec 29, 2013 at 5:13 AM
Hi, guys, I am trying to use another way to call one XLL from another XLL. See the below chart, it is copying from PlanaTech. But it is still not working. I get a "#Name" in my Excel cell when I try it. I am sure the called XLL, CalDaysInYear2, is opened in Excel. Do you guys see any error in my code? Thank you so much.

Code for XLL:
CXlOper* CalDaysInYear3_Impl(CXlOper& xloResult, double DayCount, double Basis)
{
// End of generated code
//}}XLP_SRC
// TODO - set the value of xloResult, or return another value
//        using CXlOper::RetXXX() or throw a CXlRuntimeException.
XLL_FIX_STATE;
//}}XLP_SRC
static int xlfEvaluate = 257;
static int xlUDF = 255;

CXlOper xloName, xloRef;
int rc = 0;
xloName = "CalDaysInYear2";
if (!rc)
    rc = xloRef.Excel(xlfEvaluate, 1, &xloName);
if (!rc)
    rc = xloResult.Excel(xlUDF, 2, &xloRef, &CXlOper(DayCount, Basis));
xloResult=xloRef;
return xloResult.Ret();
}

code for CalDaysInYear2 Function
CXlOper* CalDaysInYear2_Impl(CXlOper& xloResult, double DayCount, double Basis)
{
 if (Basis==0)
 {xloResult=DayCount/360;}
 else
 {xloResult=DayCount/365;}
 return xloResult.Ret();
}
Coordinator
Dec 29, 2013 at 5:48 AM
Dumb question time, but why not get PlanaTech to tell you?