Microsoft Office 2000/Visual Basic Programmer's Guide |
You create an Excel add-in by creating a workbook, adding code and custom toolbars and menu items to it, and saving it as an Excel add-in file.
To create an Excel add-in
Important When you're creating an Excel add-in, pay close attention to the context in which your code is running. When you want to return a reference to the add-in workbook, use the ThisWorkbook property, or refer to the workbook by name. To refer to the workbook that's currently open in Excel, use the ActiveWorkbook property, or refer to the workbook by name.
Once you've saved the add-in, you can reopen it in Excel to make changes to the project. The saved add-in no longer has a visible workbook associated with it, but when you open it, its project is available in the Visual Basic Editor.
Saving the add-in workbook as an Excel add-in sets the IsAddIn property of the corresponding Workbook object to True. You can set this property for the ThisWorkbook object in the Properties window in the Visual Basic Editor; setting it to False makes the workbook visible again.
You can debug an Excel add-in while it's loaded. When you load an add-in, its project appears in the Project Explorer in the Visual Basic Editor. If the project is protected, you must enter the correct password in order to view its code.