Installation of Excel AddIn for all users

Niklas 0 Reputation points
2024-01-12T09:02:27.3766667+00:00

I developed an Excel AddIn in .NET 4.7.2 and planed to distribute it using the build in ClickOnce installer from Visual Studio Professionell 2022. The installation setup is pretty simple: the user who wants to use the software has no admin privileges, but a second user has this privileges. To run the setup.exe which is created by Visual Studio are admin privileges required so the admin account installs the AddIn. The problem is now, that the AddIn is not usable for the other users. What can I change in the development process, that the AddIn is installed for all users on this end-users PC?

Microsoft 365 and Office | Development | Other
Developer technologies | .NET | Other
Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pinaki Ghatak 5,600 Reputation points Microsoft Employee Volunteer Moderator
    2024-01-12T09:23:44.2533333+00:00

    Hello @Niklas There are a few methods you can use to install an Excel AddIn for all users on a PC:

    1. Registry Modification: Excel normally loads add-ins based on per user. You can build a VB script that checks how many OPEN keys you have for each user in the registry (users may already have an xla loading at startup). Then, add an OPEN value (REG_SZ) with the path to the xla file.
    2. Modify ntuser.dat file: You can import the ntuser.dat file from c:\users\default and name it something. Then modify the key HKEY_USERS\SOMETHING\software\Microsoft\Office\16.0\Excel\Options and make the add-in start for any new user of the machine.
    3. Copy Add-in to XLSTART folder: You can copy the Add-in to the XLSTART folder. On Excel 2013 on Windows 64-bit systems, that ends up at C:\Program Files (x86)\Microsoft Office\Office15\XLSTART. On Excel 2016, it’s C:\Program Files\Microsoft Office\Office16\XLSTART. Then when any user starts Excel, an extra menu item shows up top “Add-ins” and your add-in can be accessed from there.
    4. Automation: Without modifying the registry manually, you can try the following code for every user to install an Excel add-in with automation:
    Dim oXL As Object, oAddin As Object
    Set oXL = CreateObject("Excel.Application")
    oXL.Workbooks.Add
    Set oAddin = oXL.AddIns.Add("C:test.xla", True)
    oAddin.Installed = True
    oXL.Quit
    Set oXL = Nothing
    

    Please note that these methods may require administrative privileges. Always remember to backup your registry before making any changes. It’s also important to note that these methods might not work with all versions of Excel or Windows, so testing in your specific environment is crucial. I hope this answers your question?

    1 person found this answer helpful.

  2. Olaf Helper 47,436 Reputation points
    2024-01-12T10:00:34.95+00:00

    using the build in ClickOnce installer

    A ClickOnce installation is always a user related installation, that's what it's intended for and there is nothing you can change. Only option is to create a "real" installer.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.