Excel SDK Functions

May 22, 2013 at 12:40 AM
Edited May 22, 2013 at 12:54 AM
Hi Keith,

First of all, thanks for the excellent XLL package! I'm fairly new to C++ so please bear with me.

I was wondering if there is a way to call functions from the Excel SDK, such as xlAutoAdd() and xlAutoRemove()? E.g. to generate a pop-up when the Add-In is turned on / off, but only when its status has changed (i.e. not on each open/close of Excel)?

E.g. from the Excel SDK (GENERIC.C):
__declspec(dllexport) int WINAPI xlAutoAdd(void) {
  ... do stuff here ...
  return 1;
}
Currently I am forcing a start-up procedure, but it runs on each start-up of Excel or the Add-In, rather than only when the Add-In is turned on.
//Define start-up procedure
bool StartUp() {
  ... do stuff here ...
  return 1;
}

//Call StartUp() procedure once
bool startup = StartUp();
Coordinator
May 22, 2013 at 9:43 AM
Edited May 27, 2013 at 12:40 PM
Hi Dan, I need to add documentation for that. In the meantime you can do something like
int xll_macro(void) // no WINAPI
{
    Excel<XLOPER>(xlcAlert, OPER("Built on " __DATE__ " at " __TIME__), OPER(2));

    return 1; // or 0 if things go pear shaped
}
static Auto<Add> xao_macro(xll_macro);
static Auto<Remove> xar_macro(xll_macro);
See auto.cpp for all the hooks.
May 23, 2013 at 11:08 PM
Thanks Keith!
Coordinator
May 27, 2013 at 12:20 PM