There are several reasons why you might want to create an add-in from your code. The number one reason is to create a seamless extension to Microsoft Excel. Add-ins also have slightly different error handling attributes than regular VBA macros. This will be covered later in the chapter under the section titled "Error Handling."
Once your add-in is opened (either manually or by using the Add-In Manager), it can appear to be an integral part of the Microsoft Excel environment. If you have created a project containing a number of custom worksheet functions, creating an add-in from the project will make those functions available to all workbooks whenever the add-in is open.
For projects that involve user interaction with worksheets, creating a separate add-in also allows you to take advantage of the principle of modularity. The code that runs the project is contained in a workbook that is completely separate from the one seen by the user. This makes it very easy to update your code, by simply plugging in a new add-in.
Unlike in previous versions of Microsoft Excel, creating an add-in is no longer necessary in Microsoft Excel 97 to protect your code from prying eyes. With Microsoft Excel 97 VBA, you can lock your code for viewing whether or not it is an add-in. This is a very useful feature if you need to allow the user access to any worksheets or chart sheets in your workbook but wish to keep the code of the add-in hidden. Creating an add-in from your project completely hides the workbook from the user. Your add-in workbook is not visible to the user (it opens hidden) and it doesn't appear on the Window menu.