Types of Applications
You can create three different types of applications from within Excel. Which type you choose determines how the application is used and distributed:
- Workbooks
Package code as part of a unique document. The code is stored with the workbook file (.xls) and is available whenever the user opens that file in Excel. If the user copies the file, the code is copied along with the rest of the workbook.
- Templates
Include code as part of a template for new Excel workbooks. When a user creates a new workbook file (.xls) from the template (.xlt), the code contained in the template is available in that new workbook though the code is not actually copied to the workbook.
- Add-ins
Include code as a file that can be loaded into the Excel application. If a user loads an add-in file (.xla), code from that add-in is available for any workbook a user opens.
Table 6-1 describes the relative advantages of these different types of applications.
Table 6-1. Ways to distribute code in Excel
Code stored in |
Available to |
Advantage |
Disadvantage |
---|---|---|---|
Workbook (.xls) |
Currently loaded workbooks |
No installation required; easy to distribute. |
Updates are difficult because the workbooks may be copied/renamed and there’s no way to merge new code. |
Template (.xlt) |
Workbooks based on the template |
Single file; code applies to specific type of workbook. |
Templates must be installed. |
Add-in (.xla) |
All workbooks |
Single file; code most widely available. |
Add-ins must be installed; don’t include ... |
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.