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_XLLFN3(SheetTest, SheetTest_4, SheetTest_12, "RC", "UC%", L"SheetTes" L"t", 0, L"FullName", 0, L"14", 0, L"Split a full sheet name into book and" L" sheet name parts", 0, L"No description provided\0", 0, 0, L"{SheetTest," L",,Split a full sheet name into book and sheet name parts,14,1,132,U,{{0," L"{FullName,String,0,,No description provided,,,,}}},{},3,,0,0}", 1) CXlOper* SheetTest_Impl(CXlOper&, const CXlStringArg&); extern "C" __declspec(dllexport) LPXLOPER12 SheetTest_12(const XCHAR* FullName) { XLL_FIX_STATE; CXlOper xloResult; CXlStringArg FullName__port(FullName); try { CXlStructuredExceptionHandler _seh_; xloResult.HandleResult(SheetTest_Impl(xloResult, FullName__port)); } catch(const CXlRuntimeException& ex) { CXllApp::Instance()->DisplayException(xloResult, ex); } return xloResult.Ret12(); } extern "C" __declspec(dllexport) LPXLOPER4 SheetTest_4(const char* FullName) { XLL_FIX_STATE; CXlOper xloResult; CXlStringArg FullName__port(FullName); try { CXlStructuredExceptionHandler _seh_; xloResult.HandleResult(SheetTest_Impl(xloResult, FullName__port)); } catch(const CXlRuntimeException& ex) { CXllApp::Instance()->DisplayException(xloResult, ex); } return xloResult.Ret4(); } CXlOper* SheetTest_Impl(CXlOper& xloResult, const CXlStringArg& FullName) { // End of generated code //}}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(); }