What is a nice way to install Excel addins?
I want to easily push out Excel addins and it’s dependent files that can all be stored in one directory. I want the users to get a never version on request or I want to push it out to their PCs.
This is inside of a company where I have full control over the environment.
you can insert this code in your *.xlam in the “ThisWorkBook” module
this code install and activate the current AddIns
Private Sub Workbook_Open() Dim oXL As Object, oAddin As Object URL = Me.Path & "\" normalUrl = Application.UserLibraryPath ' Environ("AppData") & "\Microsoft\AddIns" AddinTitle = Mid(Me.Name, 1, Len(Me.Name) - 5) If URL <> normalUrl Then If MsgBox("Can you Install AddIns ?", vbYesNo) = vbYes Then Set oXL = Application ' CreateObject("Excel.Application") oXL.Workbooks.Add Me.SaveCopyAs normalUrl & Me.Name Set oAddin = oXL.AddIns.Add(normalUrl & Me.Name, True) oAddin.Installed = True oXL.Quit Set oXL = Nothing End If End If End Sub
Assuming you are trying to deploy an addin solution which you have created. You would take the set of excel macros you want in the addin and save it to an xlsm excel file in 2007/2010 or simply an xls file for 2003. From there go to your VBA Project Window (Alt + F11) and click once on the “ThisWorkBook” object as shown below and change the workbook properties to become an excel addin by changing the IsAddin to True.
Keep in mind this will remove the excel sheets from view as it becomes an xla or xlam extension. DOn’t panic, you just made your excel workbook into an addin. Save it in the top left corner save icon and you have created your addin. You can follow the below procedures to link your addin to other workbooks.
After that, you must be aware of where you saved the excel file because that will the location of the addin file (since they are one and the same).
Now, open an excel file you want this addin connected to.
From there go to the vba project window again and go to tools and reference and select the excel addin you just made.
The approach I use in my company is to store the addin files (and any other dependant files) in an svn repository. Users check out the relavent folder to their machine to a consistent location (can be a bit like herding cats to get everyone to use the same folder structure).
When an update is available simply advise users to update their svn checkout folder.