XLL+ Class Library

CXllApp::SplitSheetName() Example

This example returns an array containing two cells: the book name and the sheet name contained in the argument FullName.

// Function:    SheetTest
// Purpose:     Split a full sheet name into book and sheet name parts

//{{XLP_SRC(SheetTest)
    // NOTE - the FunctionWizard will add and remove mapping code here.
    //    DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN2(SheetTest, "RC", "SheetTest", "FullName", 
    "User Defined", "Split a full sheet name into book and sheet name "
    "parts", "No description provided\000", "\0appscope=1\0", 1)

extern "C" __declspec( dllexport )
LPXLOPER SheetTest(const char* FullName)
{
    XLL_FIX_STATE;
    CXlOper xloResult;
//}}XLP_SRC

    CString bookName, sheetName;
    CXllApp::SplitSheetName(FullName, bookName, sheetName);

    xloResult.AllocArray(1, 2);
    xloResult.Cell(0, 0) = bookName;
    xloResult.Cell(0, 1) = sheetName;
    return xloResult.Ret();
}

Uses

CXllApp::SplitSheetName