ZackSoft Banner ZackSoft Banner
ZackSoft Banner ZackSoft Banner
ZackSoft Banner ZackSoft Banner
ZackSoft Banner ZackSoft Banner
ZackSoft Banner ZackSoft Banner
 
 
 
Home
Separator
Excel Add-Ins
Separator
C++ XLL
Separator
Freeware
Separator
Download
Separator
Purchase
Separator
Updates
Separator
Separator
Tutorial
Separator
XllCpp Library Runtime Royalty Free
Dotted Line

This library is a C++ wrapper for Excel 2007 SDK to ease XLL add-in development and is distributed with both ASCII and Unicode versions for debug and release for Microsoft Visual Studio C++ version 2003 or later.

Key Features
  • xlloper/xlloper12 class wrappers for the xloper/xloper12 structure with automatic memory handling for xltypeStr, xltypeRef and xltypeMulti.
  • xllregister class template to register and unregister add-in functions.
  • xllapp class to get the IDispatch of the currently running Excel instance and trap its application events
  • seh_exception class to catch Win32 exceptions.
  • xllmenu class to create menu bars.
Key Benefits
  • Write high speed Excel XLL add-in with ease.
  • Save development time and costs.

Worksheet Function Example

static LPCTSTR args_sumtest[] =
	{ _T("First description."), _T("Second description.") };

static xllregister<XllFns12> xl_sumtest(_T("sumtest"), _T("QBB"),
	_T("SUMTEST"), _T("First cell,second cell"),
	_T("User Defined"), _T(""), _T("Function description."),
	_countof(args_sumtest), args_sumtest);

LPXLOPER12 WINAPI sumtest(const double first, const double second)
{
    static xlloper12 result;
    try {
        seh_exception seh;
        double total = first + second;
        result = total;
    } catch (const std::exception& e) {
        result = e.what();
    }
    return &result;
}

xlAutoOpen Example

void XlWorkbookBeforeClose(Excel::_Workbook* Wb, VARIANT_BOOL* Cancel)
{
    OutputDebugString(Wb->Name);
    //*Cancel = true;
}

int WINAPI xlAutoOpen(void)
{
    try {
        seh_exception seh;
        // get the currently running Excel instance
        if (xllapp::instance() == NULL)
            return 0;

        // setup events
        xllappevt::WorkbookBeforeClose = XlWorkbookBeforeClose;

        // call the AutoOpen functions
        xllauto<AutoOpen>::run();

        // register the add-in functions
        if (xllcpp::excel_version() < 12 ? xllregister<XllFns>::run() :
            xllregister<XllFns12>::run())
            return 1;
        else
            Excel4(xlcAlert, 0, 1, _txloper(_T("Error loading XLL")));

    } catch (const _com_error& e) {
        Excel4(xlcAlert, 0, 1, _txloper(e.ErrorMessage()));
    } catch (const std::exception& e) {
        Excel4(xlcAlert, 0, 1, _txloper(e.what()));
    }
    return 0;
}

Menu Example

static xllmenu menu(MENU_WORKSHEET, _T("My Menu"));

void mainmenu()
{
    LPCTSTR text[][5] = {
        {_T("Menu 1"), _T("MENU1"), _T(""), _T(""), _T("")},
        {_T("Menu 2"), _T("MENU2"), _T(""), _T(""), _T("")},
    };

    // create the menu before Excel's Help menu
    menu.item(text, _countof(text));
    menu.create(_T("Help"));
}

// add mainmenu to the xllauto chain
static xllauto<AutoOpen> xl_mainmenu(mainmenu);



Bottom Shaded Line
Please send email to support@zack-soft.com with questions or comments about this web site.

Copyright © 2009 MCC Resources Sdn Bhd