Navigate to Developer tab > Add-Ins, browse the Add-In location to add. To change it back to a normal worksheet, change the IsAddin Property of ThisWorkbook to False. The xlam file icon looks like Excel, you can send this file for users to install.Īfter you have saved the file as. Save the Workbook as you would normally save it, except that you save it as xlam file type for Add-In.
The above code adds a button called Identify incorrect Date format. If you want to add more, copy the code and change the Caption and OnAction parameters. OnAction = "checkDateText" 'The Macro name you want to triggerĪpplication.CommandBars("Formatting").Controls("Identify incorrect Date format").Delete Caption = "Identify incorrect Date format" 'The button caption
With Application.CommandBars("Formatting").Controls.Add Insert the following code in ThisWorkbook Private Sub Workbook_AddinInstall() We are going to tell Excel to remove ribbon here. Workbook.AddinUninstall Event – Triggered when users uninstall the Add-in. We are going to tell Excel to add ribbon here.
Workbook.AddinInstall Event – Triggered when users install the Add-in. In VBE (Alt+F11), double click on ThisWorkBook under VBA Project of the Add-In, we need to add two Events here: The next step is to tell Excel to create a ribbon. Change from “ThisWorkbook” to “ActiveWorkbook” if needed. You should check carefully that “ThisWorkbook” refers to the Add-in Workbook, not the ActiveWorkbook. Create Excel Add-inĪssume that you have already created several Sub Procedure in the Module of a Workbook. In the following demonstration, I will use a real example where I create several Macro for users to validate data, such as data formatting and conflicting values. In order to facilitate users to locate and run the Macro, I highly recommend to add the Macro in Ribbon. If not, create an Add-in.Īfter creating an Excel Add-in, send the Add-in to users, then install the add-in. To summarize, if your Macro is only for use in particular Workbook, you don’t have to use Add-in. If you have used Functions from Analysis ToolPak before, you realize that if you send the Workbook that used the Function (such as MRound, Networkdays) to others who do not have the Add-in, the formula will fail once refreshed. The Add-in itself is stored in the local drive of the receiver, it is not stored in a Workbook. xlam (for Excel 2007 and newer version) where users can use the Macro in any Workbook in his workstation. xla (for Excel 2003 and older version) and. You can simply add the VBA code in the Module of a Workbook and then distribute the Workbook, but the problem is that the Macro cannot be used in other Workbook.ĭepending on the situation, you may want to distribute a Macro is through Add-in. Writing your first Excel Macro by recording Macro Why use Excel Add-inĪfter you have created a Macro (Sub Procedure), you may want to distribute it for users to use.
This Excel tutorial explains how to add Excel Add-in in Ribbon.