Freigeben über


Add-ins, Templates, Wizards, and Libraries

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Creating a Microsoft Office solution is about enhancing and extending powerful applications that you and your users already have on your desktops. You can take advantage of the features in Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft Access, Microsoft FrontPage, and Microsoft Outlook, and all the time and resources Microsoft has invested in developing and testing these applications, to quickly and easily build a solution that meets your users' needs without requiring a lot of training and support.

One way to provide users with a custom solution is to build an add-in. An add-in extends an application by adding functionality that isn't in the core product itself. If you're a frequent user of Excel or Access, you may already be familiar with some of the add-ins that these applications include. For example, the Linked Table Manager in Access is an add-in that was built in Visual Basic for Applications (VBA).

There are two different types of add-ins. Component Object Model (COM) add-ins are a new technology available to Microsoft Office 2000. You can build a COM add-in that works in more than one of the Office 2000 applications. One of the sample COM add-ins included in this chapter performs the same task in Word, Excel, or PowerPoint — it displays thumbnail graphics and inserts the selected one in the current document. Of course, the code that inserts the graphic in Word isn't the same code that inserts it in Excel. But a great deal of the code is shared, and it all exists in the same file.

The other type of add-in you can create is an application-specific add-in. You can create application-specific add-ins in Office 2000 as well as in previous versions of Office. An application-specific add-in works in only one application. They're easier to build and distribute than COM add-ins, so if your solution is for only one application, you may decide to build an application-specific add-in. In addition, in order to create COM add-ins, you need either Microsoft Visual Basic or Microsoft Office 2000 Developer; if you don't have either of these, the only type of add-in that you can create is an application-specific add-in.

Another way to distribute a custom Office solution is to create a template. A template provides the user with a basis for creating a new document. For example, a Word template might include the basic information and layout for a standard report so that an employee can create a new document based on the template and simply fill in the required information.

In addition to the add-ins and templates mentioned above, you can also create two specialized kinds of add-ins: wizards and code libraries. Wizards are add-ins that walk users through a complex process step-by-step. Code libraries are add-ins in which you can store frequently used procedures and generic code. By setting a reference to a code library, you can call procedures stored within that library from your current VBA project.

Contents

What Is a COM Add-in?

Building COM Add-ins for Office Applications

Building COM Add-ins for the Visual Basic Editor

Building Application-Specific Add-ins

Creating Templates

Creating Wizards

Building Reusable Code Libraries

Where to Go from Here