View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Code to detect if add-in is available

Assuming the addin has already been installed into the addins collection

Dim adn as Addin

On error resume Next
Set adn - Addins("Hello World") ' use title
On error goto 0 ' or resume normal error handling

If adn is Nothing Then
' maybe see if it's open, if so could 'Add' it to the addins collection
' and Install it
Else
' toggle - really ?
adn.Installed = Not adn.Installed
End If

Curiosity - why toggle

Regards,
Peter T



"sweez" wrote in message
...
I have the below code that I use to toggle a third-party macro from
"installed" to "uninstalled" and vice versa:

If AddIns("Hello World").installed = True Then AddIns("Hello
World").installed = False

The problem is I can not seem to come up with code that I can use to
detect if the addin is available. So if a user does not have this
addin available the code will produce an error. I am looking for
something like below (though I know the code is not right but it
illustrates what I would like to do).

If AddIns("Hello World").available = True Then
If AddIns("Hello World").installed = True Then AddIns("Hello
World").installed = False
end if

Does anyone know how I might be able to do this? Thanks in advance
for any assistance.