Add to installed and specified

I want to check if addin is installed and what it refers to. Below is the verification code to add. How can I check if the link refers to excel.

By the link I mean Tools> Addins> Addins Dailog box> If add-ons are installed, check if the add with the specific name is checked.

I would prefer without any loop.

Sub Demo() Dim b As Boolean b = CheckAddin("Solver add-in") MsgBox "Solver is " & IIf(b, "", "not ") & "installed" End Sub Function CheckAddin(s As String) As Boolean Dim x As Variant On Error Resume Next x = AddIns(s).Installed On Error Goto 0 If IsEmpty(x) Then CheckAddin = False Else CheckAddin = True End If End Function 
+2
source share
3 answers
 Sub Sample() Dim wbAddin As Workbook On Error Resume Next Set wbAddin = Workbooks(AddIns("My Addin").Name) If Err.Number <> 0 Then On Error GoTo 0 'Set wbAddin = Workbooks.Open(AddIns("My Addin").FullName) Debug.Print "Not Referenced" Else Debug.Print "Referenced" End If End Sub 
+4
source

You need to verify that the add-on is open, pretty much like any other working environment. This will return True if the addon is loaded:

 Function AddinIsLoaded(AddinName As String) As Boolean On Error Resume Next AddinIsLoaded = Len(Workbooks(AddIns(AddinName).Name).Name) > 0 End Function 

For instance:

 Sub Test Debug.Print AddinIsLoaded("Solver add-in") End Sub 
+2
source

I had a problem that even when the function returns True, I still get an error message when I try to use this addin. It turns out that the add-on can be installed, but not "openly". Thus, in addition to checking for addin, I also check if the addin file is open. If not, I will open the add-on. See my question and answer here:

Excel VBA Checking if Addin is installed but not open

0
source

Source: https://habr.com/ru/post/1214495/


All Articles