View Full Version : Code to install addin feature

05-23-2008, 07:02 AM
I am using the following code install Analysis toolpak adin, if not installed and calling the same on WB open event:

Sub InstalAddin()
If AddIns("Analysis ToolPak").Installed = False Then
AddIns("Analysis ToolPak").Installed = True
End If
End Sub

Now if the addin feature is not installed on the computer the code throws an error (Image1 attached)
Then I have to move to tools\Addins\ ticked Analysis toolpak
Then it asks for installing the addin feature (Image2 attached)

Now I want to know how can I modify the ode so that if the addin feature is not at all installed on the macjine the code will install the feature and that it will not throw an error?

05-23-2008, 11:07 AM
when I've gotten the second error message, I've needed the Office CD to install the needed feature; is that the case here? if so, I'm pretty sure silently installing it is not possible.

05-24-2008, 02:41 AM
No in my case no office CD was needed. On clicking yes, it installed automatically.

08-28-2008, 11:50 PM
Without testing, you might look through all the known addins and then test if the addin name = "Analysis ToolPak" and set a boolean value to true if found
That way you test without specially refering to the nominated 'Addin' and avoid an error if the nominated addin does not exist