Enable COM addins in Excel through VBA

Related searches

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
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

AddIns.Add method (Excel), You must set the Installed property to install the add-in. Have questions or feedback about Office VBA or this documentation? Please see� Sub DisplayAddIns () Worksheets ("Sheet1").Activate rw = 1 For Each ad In Application.AddIns Worksheets ("Sheet1").Cells (rw, 1) = ad.Name Worksheets ("Sheet1").Cells (rw, 2) = ad.Installed rw = rw + 1 Next End Sub Use the Add method to add an add-in to the list of available add-ins.

Note: Please see the comment of BigBen below - this approach may not always work as the indexer does not always coincide with the description. If you need to search by description, then the Excel Developers answer is probably applicable (though I haven't personally tried it or needed it).


A simpler alternative to the answer of Excel Developers that worked for me is to index the com add in directly by its string name instead of looping through the com add ins using an integer index and comparing to the description. In particular, this code worked for me (I've included a connect and disconnect version):

Public Sub Connect_COM_AddIn(Name As String)
    Application.COMAddIns(Name).Connect = True
End Sub

Public Sub Disconnect_COM_AddIn(Name As String)
    Application.COMAddIns(Name).Connect = False
End Sub

Excel Add-ins - VBA Code, You can refer to them explicitly using their name or by using a numerical index. Addins("Analysis ToolPak").Installed = True | False Addins("Analysis ToolPak - VBA� I'm trying to enable one of Excel's default add-ins with VBA, and it looks like I'm typing a boolean instead of a method. All of the information I find tells me that this should enable the the Solver Add-in. AddIns("Solver Add-in").Installed = True But it doesn't. Instead, it returns "Compile Error: Invalid outside procedure."

I have the same system block mentioned earlier where system privileges won't allow me to use Application.COMAddIns(Name).Connect = True. This is a bit of a workaround, but to get the COM add ins box to pop up you can use SendKeys to pull it up. Keep in mind that SendKeys only excutes at the end of a run on Excel 2010 onwards, so to get it working correctly you would need to check if the user is connected to the add-in first thing. If so, call another sub; if not use SendKeys to get the dialog open and end the sub. These are the keystrokes that worked for me, there may need to be some edits depending on how many options are in your menus.

Sub test()

'Checks if COM is installed and active
comFound = False
comRibbon = True
For i = 1 To Application.COMAddIns.Count
    If Application.COMAddIns(i).Description = "NAME" Then
        comFound = True
        If Application.COMAddIns(i).Connect = False Then
            comRibbon = False
        End If
        Exit For
    End If
Next i

'Exits sub if not installed
If comFound = False Then
    MsgBox ("You do not have NAME installed.")
    Exit Sub
End If

'Directs user to rest of code if active, otherwise opens dialog
If comRibbon = True Then
    Call test2
Else
    MsgBox ("Please select NAME in the following dialog before rerunning.")
End If

SendKeys "%FT{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{TAB}{TAB}{TAB}{DOWN}{DOWN}{TAB}~", True

End Sub

Sub test2()
    'Rest of code
End Sub

Enable/Disable Excel Add-Ins using VBA, Hello MrExcel forum members, I am trying to enable and disable Excel's Add-Ins using VBA. I originally had code that searched through the� Addins are very powerful utilities supported by Excel or other office programs. The AddIn object is a member of the AddIns collection. The AddIns collection contains a list of all the add-ins available to Microsoft Excel, regardless of whether they’re installed. This list corresponds to the list of add-ins displayed in the Add-Ins dialog box

Enabling/Disabling Excel Add-ins via VBA - Excel General, Hi AllThe company I work for have recently purchased Hyperion Essbase which comes with an Excel Add-in. Unfortunately this add-in seems to� Open the add-in by following these steps: Choose Developer → Add-Ins → Add-Ins (or press Alt+TI). Excel displays the Add-Ins dialog box. Click the Browse button.

Use Excel VBA macros and COM add-in in one solution: C# and , Accessing Excel Add-in objects, properties and methods from VBA Cells Font dialog window from VBA, this is easily achieved using the ExecuteMso Is any chance to explore the enabled add ins using add ins object ( to� Hi All. The company I work for have recently purchased Hyperion Essbase which comes with an Excel Add-in. Unfortunately this add-in seems to conflict with an existing add-in we use from SunSystems called Vision XL (it provides a direct interface between Excel and Sun Accounts) and the two cannot be installed at the same time.

Automatically install and activate an Excel Addin with VBA code, This post explains how you can automatically install and activate an Excel Addin using VBA code. At the end you can also download the� COM Add-ins can also be loaded and unloaded through the Excel user interface. To do this, follow these steps: Click the Microsoft Office Button, and then click Excel Options. Click Add-Ins. Under Manage, click COM Add ins, and then click Go. The COM Add-ins dialog box lists all COM add-ins that are installed on the computer. The COM add-ins

Comments
  • Note that the Description property is case sensitive.
  • Thank you.. I tried the same, but am getting an error "This add-in is installed for all users on this computer and can only be connected or disconnected by an administrator". When i googled it, it says the application should be run as administrator. Even after that, it neither gave me an error nor worked. I am thinking an other way round. Is there a way to pop up the COM addins windows, so that i manually check the addin box, i want. Here is the code which worked for Addins. (Not for COM addin) Application.CommandBars(1).FindControl(ID:=943, recursive:=True).Execute
  • I've added a new question as I'm having a problem, which is related to the comment by @PerlBatch, but isn't solved by the accepted answer of this question: stackoverflow.com/questions/53338022/…
  • I haven't tested this, but can't you index the add in by name instead of looping through each add in and testing against the Name variable?
  • @ColmBhandal: No.
  • Just a note - from the documentation it looks like you can use the index or ProgID with the COMAddIns collection - but this is not the same as the description, i.e. "Oracle Smart View for Office" in OP. In other words, Application.COMAddIns("Oracle Smart View for Office").Connect would throw a subscript out of range.
  • Thanks BigBen, I'll add to the answer.