cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AlexChard
Level 3

Installing an Excel Add-In

Hi all

I'm new to IS, so please bare with me!

Uding IS Express 2008, I'm creating an install for some Excel files and an Excel Add In. I've got the basic install to copy the files to the user defined directory, including the Add In.

What I want to do now is install the Add In. I don't need to make it active (the spreadsheets control the behaviour when opened), so I just need to add it to the Add In manager (navigate Tools -> Add-Ins in Excel).

I've found this thread, but have no idea what to do with the code.

Any help will be greatly appreciated.

Alex
Labels (1)
0 Kudos
(8) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

As a general suggestion, if you are using the Express edition, it would probably be better to post in the Express edition's forum. As for installing an Excel add-in, the question you will need to answer is: what needs to be done on the target machine to make Excel aware of the add-in? It may be a matter of adding a registry key, or file, to a well-known location, and if so it should be easy. It may require calling an entry point in some DLL, which may or may not be easy. I don't personally know anything about Excel add-in registration, though, so it might be something else entirely.
0 Kudos
AlexChard
Level 3

MichaelU wrote:
As a general suggestion, if you are using the Express edition, it would probably be better to post in the Express edition's forum.


I did, but had no replies.

MichaelU wrote:
As for installing an Excel add-in, the question you will need to answer is: what needs to be done on the target machine to make Excel aware of the add-in? It may be a matter of adding a registry key, or file, to a well-known location, and if so it should be easy. It may require calling an entry point in some DLL, which may or may not be easy. I don't personally know anything about Excel add-in registration, though, so it might be something else entirely.


I'll see what's needed. Thanks for the reply.
0 Kudos
AlexChard
Level 3

According to this Microsoft article, I can use the following script:

Dim oXL As Object, oAddin As Object
Set oXL = CreateObject("Excel.Application")
oXL.Workbooks.Add
Set oAddin = oXL.AddIns.Add("C:\test.xla", True)
oAddin.Installed = True
oXL.Quit
Set oXL = Nothing


Where would I use this in IS?

Thanks

Alex
0 Kudos
rajeevranjan
Level 3

Which Type of Add-in you want to add in Excel Com Add-in or XLA Add-in?
0 Kudos
AlexChard
Level 3

It's an xla add-in.

Thanks
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Sounds like you need to call into Excel, and in order to do that you need to write a custom action. As it turns out, Windows Installer supports VB script custom actions (though there can be difficulties at runtime that e.g. a C++ DLL custom action can avoid), so you can set your installer to use this script - see the Installation Designer tab, Custom Actions view. Note that the VB runtime environment during the Install is not quite the same as that for cscript, so some small tweaks may be required.
0 Kudos
TheTraveler
Level 8

It seems that a lot of people don't use this technique, but you can translate the VB code to Install Shield script code. I quickly translated the code. So this is UNTESTED code, but the code looks good. I also have put in more checks than the original snip-it of code posted earlier. Let me know if this works. I'm thinking of using it myself.

prototype InstallExcelAddIn(BYVAL STRING);

function InstallExcelAddIn(strFileName)
OBJECT oXL;
OBJECT oAddin;
BOOL bResult;
begin
bResult = FALSE;
if Is(strFileName, FILE_EXISTS) then
///////////////////////////////////////////////////////////////////////
// Get Excel Object
///////////////////////////////////////////////////////////////////////
Set oXL = CreateObject("Excel.Application");
if IsObject( oXL ) then
oXL.Workbooks.Add();
Set oAddin = oXL.AddIns.Add(strFileName, TRUE);
if IsObject(oAddin) then
try
oAddin.Installed = TRUE;
bResult = TRUE;
catch
endcatch;
endif;
oXL.Quit();

///////////////////////////////////////////////////////////////////////
// Free up resources... //
///////////////////////////////////////////////////////////////////////
try
oAddin = NOTHING;
catch
endcatch;

try
oXL = NOTHING;
catch
endcatch;
endif;
endif;

return bResult;
end;
0 Kudos
TheTraveler
Level 8

In my search on Add-Ins, I found this piece of code. It looks like the function I wrote will work.
0 Kudos