Tip

Visual Basic add-ins

Visual Basic add-ins
Steven Roman

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

    Requires Free Membership to View

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.

  1. 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.

  2. 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.

  3. 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.


Click here to learn more about Developing Visual Basic Add-ins, or email and let us know if you are interested in this topic or any other Windows development issues.


This was first published in April 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.