Consulting

Results 1 to 4 of 4

Thread: Check to see if add-in installed

  1. #1
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location

    Check to see if add-in installed

    Hi,

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

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

    Sir BD
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    BD

    If you jsut install them it is fine even if they are already installed. Howevere, if they are not loaded this will fail.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Quote Originally Posted by xld
    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?
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Perhaps something like this

    [vba]
    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •