XLL+ Class Library

CXlOper::Excel() Example

This example demonstrates a call to the Excel SDK. It uses the xlfDate function to calculate a date in Excel format from a year, month and day.

//{{XLP_SRC(GetDate)
    // NOTE - the FunctionWizard will add and remove mapping code here.
    //    DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN2(GetDate, "R", "GetDate", "", "Demo functions", 
    "Returns a date calculated by a call-back to Excel", "", "",
    1)

extern "C" __declspec( dllexport )
LPXLOPER GetDate()
{
    CXlOper xloResult;
//}}XLP_SRC

    static int xlfDate = 65;

    CXlOper xloYear(97.0), xloMonth(12.0), xloDay(31.0);
    CXlOper xloDate;

    if (!xloDate.Excel(xlfDate, 3, &xloYear, &xloMonth, &xloDay))
        xloResult = xloDate;
    else
        xloResult = xlerrNA;
    return xloResult.Ret();
}

Uses

CXlOper::Excel