PDA

View Full Version : Check to see if add-in installed



Sir Babydum GBE
02-04-2008, 06:21 AM
Hi,

How to I add a line to this code to check whether the add-in is installed and only install it if necessary?

Application.DisplayAlerts = False
AddIns("Analysis ToolPak").Installed = True
AddIns("Conditional Sum Wizard").Installed = True
Application.DisplayAlerts = True

Sir BD

Bob Phillips
02-04-2008, 06:51 AM
BD

If you jsut install them it is fine even if they are already installed. Howevere, if they are not loaded this will fail.

Sir Babydum GBE
02-04-2008, 06:59 AM
If you just install them it is fine even if they are already installed. However, if they are not loaded this will fail.

Ok, so I guess that's really what I'm asking. At work, if a try to manually install an add-in that isn't loaded, you get a "this is not currently loaded, do you want to load it now?" type of message. Then it downloads the addin from a central server - it seems to know where to look.

So can I programmatically check whether the add-in's are loaded and install them if not?

Bob Phillips
02-04-2008, 07:24 AM
Perhaps something like this


Public Sub Test()
Dim mpaddin As String

On Error GoTo err_handler

Application.DisplayAlerts = False

mpaddin = "Analysis ToolPak"
AddIns(mpaddin).Installed = True

mpaddin = "Conditional Sum Wizard"
AddIns(mpaddin).Installed = True

sub_exit:
Application.DisplayAlerts = True
Exit Sub

err_handler:
MsgBox Err.Number & " - " & Err.Description & vbNewLine & vbNewLine & _
mpaddin
Resume sub_exit
End Sub