Registry Keys
Terminology
Not Installed - the ".xlam" or ".xla" file has been removed from the computer or shared drive.
Available - the ".xlam" or ".xla" file exists on the computer or shared drive.
Not Ticked - the add-in is available but has not been loaded in to Excel.
Loaded - the add-in is ticked and provides additional functionality.
Add-in Manager Key
The Add-in Manager key indicates that an add-in appears on the list in the Add-ins dialog box.
There can be entries here that point to files that are Not Installed.
This is updated when Excel closes.
Excel 365 - HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Add-in Manager
Excel 2021 - HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Add-in Manager
Excel 2019 - HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Add-in Manager
Excel 2016 - HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Add-in Manager
Any add-ins that have been added under the "Options" key and then manually unticked by the user are removed from the "Options" key and added here.
Options Key
The Options key indicates that an add-in is installed and will be Loaded the next time Excel opens.
This is updated when Excel closes.
If an add-in has just been ticked by the user, the registry entry will be moved from the Add-in Manager part of the registry to the Options" part of the registry when Excel closes.
Excel 365 - HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options
Excel 2021 - HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Options
Excel 2019 - HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options
Excel 2016 - HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Options
If the full path is not specified then the default folder location is "C:\Users\ "username" \AppData\Roaming\Microsoft\AddIns"
WScript
Windows has 2 VB Script processes.
WScript which has a GUI and is the default. The other one is called CScript and is Console based.
When you double click a .VBS file the WScript processes will run.
Installation and Automatic Loading
If you want an Excel add-in to appear automatically the next time they open their Excel you need to add an entry under the Options Key.
It is quite common for installers to create a registry key in this location.
The following script is VB Script that will add the corresponding registry entry under Options.
Const EXCEL_ADDIN_PATH_BEFORE = "HKCU\Software\Microsoft\Office\"
Const EXCEL_ADDIN_PATH_AFTER = "\Excel\Options\"
Const ADDIN_REG_VALUE = """C:\Program Files (x86)\Better Solutions Limited\MyExceAddin.xlam"""
Function RegistrationKeyExists(key)
On Error Resume Next
objShell.RegRead (key)
If Err = 0 Then
RegistrationKeyExists = True
Else
RegistrationKeyExists = False
End If
End Function
Function RegistrationKeyValueGet(name)
On Error Resume Next
Dim value
value = objShell.RegRead(name)
If Err = 0 Then
RegistrationKeyValueGet = value
Else
RegistrationKeyValueGet = ""
End If
End Function
Function RegistrationKeyValueSet(name, value)
On Error Resume Next
objShell.RegWrite name, value, "REG_SZ"
If Err = 0 Then
RegistrationKeyValueSet = True
Else
RegistrationKeyValueSet = False
End If
End Function
Dim EXCEL_ADDIN_PATH As String
Dim versions As Variant
Dim officeval As Variant
Dim objShell As Object
Dim count As Integer
Dim value As String
Dim exists As Boolean
Dim success As Boolean
Set objShell = CreateObject("WScript.Shell")
WScript.Echo "Excel Add-in Registration Tool"
versions = Array("12.0", "14.0", "15.0", "16.0")
For Each officeval In versions
EXCEL_ADDIN_PATH = EXCEL_ADDIN_PATH_BEFORE & officeval & EXCEL_ADDIN_PATH_AFTER
WScript.Echo "Checking Office Version - " & officeval
If (RegistrationKeyExists(EXCEL_ADDIN_PATH) = True) Then
count = 0
exists = False
value = RegistrationKeyValueGet(EXCEL_ADDIN_PATH & "OPEN")
While (Len(value) > 0 And Not exists)
count = count + 1
value = RegistrationKeyValueGet(EXCEL_ADDIN_PATH & "OPEN" & count)
If value = ADDIN_REG_VALUE Then
exists = True
End If
Wend
If (exists = True) Then
WScript.Echo "Office Version - " & officeval & " Already Registered"
Else
If (count > 0) Then
success = RegistrationKeyValueSet(EXCEL_ADDIN_PATH & "OPEN" & count, ADDIN_REG_VALUE)
Else
success = RegistrationKeyValueSet(EXCEL_ADDIN_PATH & "OPEN", ADDIN_REG_VALUE)
End If
If (success = True) Then
WScript.Echo "Office Version - " & officeval & " Registration Complete"
Else
WScript.Echo "Office Version - " & officeval & " Unable to Register Add-In"
End If
End If
Else
WScript.Echo "Office Version - " & officeval & " Not Found"
End If
Next
Set objShell = Nothing
HKEY_LOCAL_MACHINE
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Excel\Addins\
Add-ins installed into local machine are also displayed in the COM add-ins dialog box.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext