Visual Basic add-ins
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The Visual Basic development environment is poorly documented but offers much of the functionality of MS Office applications through the VB Extensibility Model. The creation of add-ins can make the life of VB developers much simpler. This excerpt from Steven Roman's book Developing Visual Basic Add-ins, provides an overview of the add-in creation process.
The Add-in creation process
The process of creating an add-in is actually fairly easy to follow if we think about the more or less common-sense steps that are required to prepare an add-in for use. This does not include adding functionality (that is, features) to the add-in, which is the major part of add-in creation. To help avoid confusion, note that there is a distinction between the add-in programmer (that's us) and the add-in user, who is also programming in the VB-environment.
- Registering the add-in
As with most Windows applications, we must provide a means for VB to get general information about our add-in. This information includes the kind (DLL or EXE) and location of the add-in's public class. This information is provided by registering the add-in in the system registry.
- Providing a method for add-in activation
An add-in can be activated--that is, executed (for an EXE) or loaded (for a DLL)--either during a VB session or when VB is started. The most common way for a user to activate an add-in is by using the Add-In Manager. We must therefore instruct the Add-In Manager to include ours in its list of available add-ins. In VB5, this is done by placing a line in the vbaddin.ini file, which resides in the Windows directory. In VB6, the process is made a bit simpler by using the Add-In Designer.
Alternatively, add-ins can be activated programmatically by other add-ins. This is the basis for VB's Add-In Toolbar, which is an add-in whose sole function is to activate other add-ins. As the name implies, the Add-In Toolbar displays a toolbar with buttons for each installed add-in, as well as a button for installing or removing additional add-ins.
- Connecting the add-in
Finally, we must provide VB with a way to give our add-in programmatic access to the VB IDE. After all, this is the whole point of an add-in. This process is properly referred to as connecting the add-in (although some may use this term more loosely to refer to the activation process as well). There is a slight difference in the way this is done in VB5 and VB6, but the principle is the same in both cases.
Connecting an add-in is by far the most interesting portion of add-in setup.