Load Add-in's Without Using Add-in Manager

Discussion in 'Microsoft Excel Programming' started by McRolin, Mar 11, 2004.

  1. McRolin

    McRolin Guest

    Hello All,
    I have built an Excel add-in (C++) containing a set of lognormal
    distribution functions. I want to distribute the add-in but currently
    require the user to open Excel and load the add-in using the add-in manager.
    I would prefer to "add" the add-in to Excel's add-in list during my
    installation. Is there away to automatically load the add-in without having
    the user manually do it?

    Thanks, Roger
     
    McRolin, Mar 11, 2004
    #1
    1. Advertisements

  2. Roger,

    try this.

    Sub InstallAddIn()
    'this is a VB routine that runs as part of an external installation package
    to register an add-in with xl
    'this was based on something I saw in the groups I think, but apoligies to
    original author since I cannot remember who it was

    Dim strApp As String
    Dim strAddInPath As String
    Dim oAddin As Object
    Dim oXL As Object
    Dim nExcelCount As Integer

    strApp = App.Path

    nExcelCount = 0

    TestForExcel:

    On Error Resume Next
    Set oXL = GetObject(, "Excel.Application")
    On Error GoTo 0

    If Not (oXL Is Nothing) Then

    If nExcelCount = 0 Then

    Call MsgBox("Please save any files and quit Microsoft Excel then
    press OK", _
    vbOKOnly, msgTitle)

    Else

    Call MsgBox("You still have Excel running. To register this add-in
    with Excel " & _
    "you need to exit Excel first" & vbCrLf & vbCrLf & _
    "If you can't see a running instance of Excel you may have a
    hidden instance running" & vbCrLf & vbCrLf & _
    "To close a hidden instance, press ALT-CTRL-DEL and remove Excel
    from the list of running processes", _
    vbOKOnly + vbInformation, msgTitle)

    End If

    nExcelCount = nExcelCount + 1
    Set oXL = Nothing
    GoTo TestForExcel

    End If

    Set oXL = CreateObject("Excel.Application")

    'have to add a workbook or you can't add an add-in
    oXL.Workbooks.Add

    'never been happy with this line since the user could have changed the
    default install path
    'if you are running your own installer, you could make sure you trap the
    right path
    strAddInPath = Environ("ProgramFiles") & "\Enhanced
    Datasystems\EFALoader.xla"

    Set oAddin = oXL.Addins.Add(strAddInPath)
    oAddin.installed = True
    oXL.Quit
    Set oXL = Nothing

    Call MsgBox("Install complete", vbInformation + vbOKOnly, "Enhanced
    Datasystems")

    End Sub

    Robin Hammond
    www.enhanceddatasystems.com


    "McRolin" <> wrote in message
    news:%QP3c.10615$...
    > Hello All,
    > I have built an Excel add-in (C++) containing a set of lognormal
    > distribution functions. I want to distribute the add-in but currently
    > require the user to open Excel and load the add-in using the add-in

    manager.
    > I would prefer to "add" the add-in to Excel's add-in list during my
    > installation. Is there away to automatically load the add-in without

    having
    > the user manually do it?
    >
    > Thanks, Roger
    >
    >
     
    Robin Hammond, Mar 11, 2004
    #2
    1. Advertisements

  3. Hi Roger,

    > I have built an Excel add-in (C++) containing a set of lognormal
    > distribution functions. I want to distribute the add-in but currently
    > require the user to open Excel and load the add-in using the add-in manager.
    > I would prefer to "add" the add-in to Excel's add-in list during my
    > installation. Is there away to automatically load the add-in without having
    > the user manually do it?


    Sure. Find the registry key:

    HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Options

    where 9.0 is Excel 2000, 10.0 is Excel XP etc.

    In there, add a new string value, with the next item in the sequence:

    OPEN
    OPEN1
    OPEN2
    ... etc

    i.e. if OPEN doesn't exist, use that. If OPEN, OPEN1 and OPEN2 exist, you
    have to use OPEN3. The value of the key is the file name of your xll.

    Regards

    Stephen Bullen
    Microsoft MVP - Excel
    www.BMSLtd.ie
     
    Stephen Bullen, Mar 11, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. McRolin

    Setup Excel to Load Add-in Without Add-in Manager

    McRolin, Mar 12, 2004, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    250
    Jan Karel Pieterse
    Mar 12, 2004
  2. Bura Tino

    Order in which add-ins load

    Bura Tino, Apr 24, 2004, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    1,337
    Gord Dibben
    Apr 24, 2004
  3. Aaron Fude

    Script to start Excel and load the add-ins

    Aaron Fude, Oct 21, 2004, in forum: Microsoft Excel Programming
    Replies:
    3
    Views:
    842
    keepITcool
    Oct 21, 2004
  4. Aaron Fude

    VBS script to start Excel and load Add-ins

    Aaron Fude, Oct 29, 2004, in forum: Microsoft Excel Programming
    Replies:
    3
    Views:
    2,782
    keepITcool
    Oct 30, 2004
  5. scott

    Load Add-Ins

    scott, Aug 25, 2007, in forum: Microsoft Excel Programming
    Replies:
    3
    Views:
    170
    Guest
    Aug 26, 2007
Loading...

Share This Page