Solved

Installing Excel Add-ins Where All Users Can Access Them

Posted on 2006-11-23
2
951 Views
Last Modified: 2007-12-19
On Win XP: How can I install an Excel Add-in so that all logged-on users can see it?  
I tried putting it into the "All Users" directory, installing it into Excel while logged on as Administrator,  then switching to another user.  I was hoping the xla would be installed in Excel which I started it as that user, but it was not. Tried to manually install the add-in. The default path it wanted to go to was the home directory of that user. When I tried to navigate to the "All Users" directory, Application Data and below was not even visible.

The ideal solution would be if I could put the add-in in the All Users directory, install it into Excel, then have it already be installed in Excel for every user who then logged on.
     
0
Comment
Question by:whandley
2 Comments
 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
Hi whandley,
Try the XLSTART folder in C:\Program Files\Microsoft Office\OFFICE11\XLSTART if you want the add-in to open automatically (without user intervention).

Try the C:\Program Files\Microsoft Office\OFFICE11\Library if you want users to choose the add-in from the Tools...Add-Ins menu item. You will probably want to set the Title property of the file, as that controls the text you see in the Tools...Add-Ins menu item. You do this by right-clicking the file in the Windows Explorer, then choosing Properties from the resulting pop-up. The Title property is found on the Summary tab.

Hoping to be helpful,

Brad
0
 

Author Comment

by:whandley
Comment Utility
Thanks for that, byunt, you've earned the points.

I didn't want the users to have to manually install the xla, since they are running a setup program which would be expected to be capable of doing this for them,  so I'm now copying the XLA into XLSTART when the "all users" install option is selected.  However, although the functionality of the add-in is indeed there as you imply for any user when he/she opens Excel, the add-in does not appear in the list of add-ins. This is because Excel has merely loaded the xla file, it has not really installed it.  

This could be confusing. So I enhanced the solution a bit by adding code to the Workbook_Open event that fires when Excel loads the xla file from the XLSTART directory.  The code checks to see if it has been installed for this particular user, and if not, it installs itself silently. Now our add-in appears in that user's add-ins list, and is checked as "installed." The resulting effect is as if the setup program had indeed installed the add-in for "all users who log onto this machine," exactly the effect I was looking for. In case anyone else ever has this particular requirement, my Workbook_Open event code is as follows. The name of add-in has been deleted to avoid any possible issues.

Public ignoreWorkBookOpenEvent As Boolean
Public addinManagerUsed As Boolean


Private Sub Workbook_AddinInstall()
    'When user installs <addin name deleted> via Addin Manager,
    'this event fires before the Workbook_Open event
    'Following flag is checked by Workbook_Open below
    addinManagerUsed = True
End Sub


Private Sub Workbook_Open()
    Dim AddinModule As AddIn
    Dim dummyWorkbookAdded As Boolean
    Dim dummyWorkbook As Workbook
    Dim haveAddIn As Boolean
    Dim installMenuOk As Boolean
    Dim needInstall As Boolean

    If ignoreWorkBookOpenEvent Then
        'Avoid reentry; e.g., when code belows
        'installs this addin, this event fires again
        Exit Sub
    End If
    If Not addinManagerUsed Then
        'Need to avoid doing this if we are opening the
        'the application as an xls to do work on it
        If ThisWorkbook.IsAddin Then
            'Determine if <addin name deleted> addin is already in the addins collection
            For Each AddinModule In AddIns
                If AddinModule.Name = "<addin name>" Then
                    haveAddIn = True
                    Exit For
                End If
            Next
            If haveAddIn Then
                If AddinModule.Installed = False Then
                    '<addin name deleted> is on the list, but is not installed
                    needInstall = True
                Else
                    '<addin name deleted> is already installed
                    needInstall = False
                End If
            Else
                '<addin name deleted> is not on the list of add-ins
                needInstall = True
            End If
            If needInstall Then
                If Workbooks.Count < 1 Then
                    'Can not install an addin if no visible workbook, for reasons known only to MS
                    Set dummyWorkbook = Workbooks.Add
                    dummyWorkbookAdded = True
                End If
                'Following code re-fires this event, so block it
                'to avoid endless looping
                ignoreWorkBookOpenEvent = True
                'Add to collection of addin names
                On Error Resume Next
                Set AddinModule = AddIns.Add(ThisWorkbook.FullName, True)
                AddinModule.Installed = True
                If dummyWorkbookAdded Then
                    'Remove the workbook needed to make Addins.add work
                    Application.DisplayAlerts = False
                    dummyWorkbook.Close
                    Application.DisplayAlerts = True
                End If
                ignoreWorkBookOpenEvent = False
                On Error GoTo ErrorHandler
            End If 'Do we need to install the add-in?
        End If 'Is the workbook being opened as an xla or as an xls?
    Else 'Event fired because user installed the workbook via add-in manager
        MsgBox "You have successfully installed the <addin name deleted>" & vbCrLf & _
        "Please use the menu item ""<addin name deleted>"" to <deleted>", vbInformation, "Install <addin name deleted>"
    End If 'If addin manager used to install <addin name deleted>
 
  *** rest of Workbook_Open code***






     






     
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Let’s list some of the technologies that enable smooth teleworking. 
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now