+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Valued Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2007
    Posts
    332

    Verify existence of a custom add-in

    Hello... do any of you experts know if there's a way I can verify that a custom add-in is active?

    My company uses an add-in to allow end users to construct several types of API calls. My program depends on that add-in to be installed. I'd like to try to detect the add-in and halt the program if it's not there.

    Thanks for any help!
    Last edited by JP Romano; 06-03-2009 at 04:11 PM. Reason: Resolved

  2. #2
    Forum Moderator dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003 & 2007
    Posts
    3,661

    Smile Re: Verify existence of a custom add-in

    Good afternoon JP Romano
    Quote Originally Posted by JP Romano View Post
    do any of you know if there's a way I can verify that a custom add-in is active?
    The code below will return a True / False answer :
    Code:
    MsgBox AddIns("My Add-In").Installed
    HTH

    DominicB
    Now available : Ultimate Add-In 2007
    Integrates directly into the Office Excel Ribbon


    Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
    90+ Utilities, 200+ Sub utilities last updated 25th April 2008
    Free!!

  3. #3
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Verify existence of a custom add-in

    This pair of functions may help:
    Code:
    Function AddinIsInstalled(ByVal sName As String) As Boolean
        ' Returns returns True if add-in is installed
        Dim oAddIn As AddIn
        
        sName = UCase(sName)
        For Each oAddIn In Application.AddIns
            If UCase(oAddIn.Name) = sName Then
                AddinIsInstalled = True
                Exit For
            End If
        Next oAddIn
    End Function
    
    Function InstallAddIn(ByVal sPath As String, sName As String) As Boolean
        ' Installs an add-in, returns True if successful.
        Dim oAddIn As AddIn
        
        If Right(sPath, 1) <> "\" Then sPath = sPath & "\"
        If AddinIsInstalled(sName) Then Application.AddIns(sName).Installed = False
    
        On Error Resume Next
        Set oAddIn = Application.AddIns.Add(sPath & sName)
        oAddIn.Installed = True
        InstallAddIn = Err.Number = 0
        Err.Clear
    End Function
    Example usage:
    Code:
    InstallAddIn "C:\myPath", "myAddIn.xla"
    Last edited by shg; 06-01-2009 at 04:06 PM.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Valued Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2007
    Posts
    332

    Re: Verify existence of a custom add-in

    These are great suggestions, and I'll have at them this afternoon. Many MANY thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0