Based on Sean Cheshire’s link to Michaels’s answer:
“I have found an example over at JKP Application Development Services originally found by Laurent Longre. One caveat is explained below:
Disadvantage of this trick method, is that one is actually re-registering a function within the dll one uses, which might be used by any program.
http://www.jkp-ads.com/Articles/RegisterUDF01.asp
This solution only registers/un-registers the UDF, but the user will still have to save the workbook as an .xlam and install the addin. I used the following code to automatically install the current workbook as an Excel addin (if you are going to be updating the addin, you'll need to add some error catching to determine if the addin is already installed).
'Saves current workbook as an .xlam file
sFile = Application.LibraryPath & "\" & "name_of_addin" & ".xlam"
ThisWorkbook.SaveAs sFile, 55
ThisWorkbook.IsAddin = True
'Adds temporary workbook
Workbooks.Add
'Installs the addin
Set oAddin = AddIns.Add(sFile , False)
oAddin.Installed = True
'Closes temporary workbook
Workbooks(Workbooks.Count).Close
MsgBox ("Installation Successful. Please close Excel and restart.")
'Closes workbook without saving
Workbooks(sFirstFile).Close False
The link is still live.