Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2003
    Location
    Minneapolis, Minnesota, USA
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change an addin's path (2000+)

    I wish to update the path to my addin in code but I have not found a way my users have different versions of Excel. This is what I am trying:
    During software installation, I delete all prior xla files on the user's machine. Then I place it in the *new standard* file location. What I want to have happen is for the new addin file to be active. What I find is in Tools / Addins, the addin is unchecked and when I check it, Excel reports that it cannot find it. It then removes it from the list of addins. This code works nicely if the user never had my addin but not if they already have it installed. I do not want my users to have to do any installation actions other than launch the installation.
    Is there a way to remove the addin from the addins collection? Local coding standards will not let me delete from the registry things I have not explicitly put there.

    Here is my VB code:

    Private Const cstrAddinNameAndPath = "D:burp.xla"
    Private Const cstrAddinName = "Burp"
    Private Const cstrAddinPath = "D:"

    Private Sub Form_Load()
    'code from MSDN KB Article 280290
    'HOWTO: Install and Excel Add-In (XLA or XLL) with Automation
    Dim blnNotPresent As Boolean
    Dim oXL As Object
    Dim oAddin As Object

    blnNotPresent = False

    Set oXL = CreateObject("Excel.Application")
    'need empty workbook in order to add an addin
    oXL.WorkBooks.Add

    On Error GoTo NoAddinPresent
    Set oAddin = oXL.Addins.Item(cstrAddinName)

    On Error GoTo Errorhandler
    If blnNotPresent Then
    Set oAddin = oXL.Addins.Add(cstrAddinNameAndPath, True)
    oAddin.Installed = True
    Else
    'this is the section which doesn't work
    oAddin.Installed = False
    Set oAddin = Nothing
    Set oAddin = oXL.Addins.Add(cstrAddinNameAndPath, True)
    oAddin.Installed = True
    End If

    Cleanup:
    oXL.quit
    Set oAddin = Nothing
    Set oXL = Nothing
    End

    NoAddinPresent:
    blnNotPresent = True
    Resume Next

    Errorhandler:
    MsgBox "Error installing addin. Please select " & cstrAddinNameAndPath & _
    " from the Tools/Addins dialog."
    Resume Cleanup

    End Sub

  2. #2
    New Lounger
    Join Date
    Mar 2003
    Location
    Minneapolis, Minnesota, USA
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change an addin's path (2000+)

    I've just seen MS KB article 211956 which talks about doing this via the registry for Excel 2000. It says to look in
    HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0ExcelAd d-in Manager
    I have seen the same thing for Excel 97 except with a different version number.
    Can someone look in their registry with OfficeXP? Thanks!
    I think that I am going to change the registry and apologize if caught.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: change an addin's path (2000+)

    In Excel 2002 (XP), loaded Excel Add-ins are in the HKEY_CURRENT_USERSoftwareMicrosoftOffice10.0ExcelO ptions key, in values named OPEN, OPEN1, OPEN2 etc. After unloading a custom add-in, its location is saved in the HKEY_CURRENT_USERSoftwareMicrosoftOffice10.0ExcelA dd-in Manager key, in a value that has the full path to the add-in as name.

  4. #4
    New Lounger
    Join Date
    Mar 2003
    Location
    Minneapolis, Minnesota, USA
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change an addin's path (2000+)

    Thanks Hans.
    Here is a VB 6 project (that ought to work in VBA if you so choose) that will either add your addin as a new addin in Excel (versions 8-11) or will alter the registry so that Excel will look in the location you choose. It is up to you to delete the old addin file if you so chose.

Posting Permissions

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