Saving Functions in Add-Ins

To share a custom function, you must first decide whether the user should be allowed to view the function code. Excel offers add-ins that allow you to hide the code of VBA functions. To create your own add-in, do the following:

  1. Create the modules you want to save in the add-in.

  2. Select the Debug/Compile VBAProject option in the Visual Basic Editor to compile the project, to ensure that no syntax errors exist.

  3. Switch to the Excel window.

  4. Select File/Save As (in Excel 2007, click the Office button and select Save As/Other Formats).

  5. In all versions of Excel except Excel 2007, select the Excel Add-In (*.xlam) file format (in versions of Excel before Excel 2007, the extension appears as *.xla), and enter a name.

  6. Switch back to the Visual Basic Editor.

  7. In the Project Explorer, select This Workbook.

  8. In the Properties window, set the IsAddin property to True. The included worksheets are now hidden.

  9. Save your changes in the Visual Basic Editor.

Important

If you close Excel now, you can still create a backup copy. Excel offers the standard format again. But if you choose the standard format (*.xlsx), Excel will display a message box telling you that you are going to save your work as a macro-free workbook. You should click No and save your work as a macro-enabled file (*.xlsm).

You can integrate the add-in with the Add-in Manager. If the file is open, it is displayed in the Project Explorer. You can select and edit the file.

The worksheets of this file are hidden, but the included functions are displayed in the Function Wizard, in the Custom category.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.51.145