Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trying to install an add in using automatisation directly via C++
Hi,
I'm quite new to automatisation programming and really just want to touch it (at least right now... ,-)). I've created an Excel-Addin which gets installed using an installer package. At the end of the installation process the add-In should be installed in Excel automagically so the user does not have to care for this. Using VBA the following two lines would do the job (add some glue code here): // AddIns.Add "E:\CreditToolbox\ExcelAddin\build\Managed.XLL " // AddIns("KreditPricer PLUS").Installed = True However, I don't have VBA available and I'd like to do it with C++ as all the other parts of the project are also C++. So I crossed to solutions from MS at http://support.microsoft.com/kb/q216686/ and http://support.microsoft.com/kb/196776/ and tried to modify them for my purpose. The following code is here (the XLL to register is hardcoded in the example, AutoWrap function is copied from KB216686): ================================================== ======================= // Start server and get IDispatch...this one works IDispatch *pXlApp; hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void **)&pXlApp); if(FAILED(hr)) { ::MessageBox(NULL, "Excel not registered properly", "Error", 0x10010); return -2; }; // Get Addins collection...this one works IDispatch *pXlAddins; { VARIANT result; VariantInit(&result); AutoWrap(DISPATCH_PROPERTYGET, &result, pXlApp, L"AddIns", 0); pXlAddins = result.pdispVal; }; // Call the "Add" method and install the Addin { VARIANT param; param.vt = VT_BSTR; param.bstrVal = ::SysAllocString(L"E:\\CreditToolbox\\ExcelAddin\\ build\\Managed.XLL"); AutoWrap(DISPATCH_METHOD, NULL, pXlAddins, L"Add", 1, param); VariantClear(¶m); }; ================================================== ======================= While the first two calls work, the third fails with the error 0x800a03ec which says something like " [Method name] method of [object] class failed.". So what am I missing here, this should be dead simple... Thanks a lot in advance, Soeren Gerlach |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trying to install an add in using automatisation directly via C++
Soeren, have a look in your private email. Best regards, Jens schrieb: Hi, I'm quite new to automatisation programming and really just want to touch it (at least right now... ,-)). I've created an Excel-Addin which gets installed using an installer package. At the end of the installation process the add-In should be installed in Excel automagically so the user does not have to care for this. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
try to install a security update, prompted to install PRO11.msi | Setting up and Configuration of Excel | |||
Automatisation - Operations on a table on one line | Excel Discussion (Misc queries) | |||
What program do I install to install office 2003 with no prior pro | Excel Discussion (Misc queries) | |||
Why does PHStats *NOT* install when I install Analytical ToolPak? | Setting up and Configuration of Excel | |||
Can I convert directly from excel to RTF? | Excel Discussion (Misc queries) |