Enable COM addins in Excel through VBA

PerlBatch picture PerlBatch · Feb 1, 2018 · Viewed 7.2k times · Source

I need to enable COM addins through VBA. The addins already exists under COM addins, but become unchecked when Excel crashes.

Sub hyp()
    Dim objAddIn As Object
    For i = 1 To Application.COMAddIns.Count

        Set objAddIn = Application.COMAddIns.Item(i)
        On Error Resume Next
        If Application.COMAddIns.Item(i).Description = "Oracle Smart View for Office" Then
            'MsgBox Application.COMAddIns.Item(i).Description
            'NEED TO ENABLE THE COM ADDIN

        Else
        End If
    Next i
End Sub

Answer

Excel Developers picture Excel Developers · Feb 1, 2018
Public Sub Connect_COM_AddIn(Name As String)

    Dim ndx As Integer

    For ndx = 1 To Application.COMAddIns.Count
        If Application.COMAddIns(ndx).Description = Name Then
            Application.COMAddIns(ndx).Connect = True
            Exit For
        End If
    Next
End Sub