Developing Visual Basic Add-ins

ISBN: 1-56592-527-0, 200 pp., $27.95

Return to Roman Press Home Page
Return to computer books' main page

To order this book through Amazon.com, please click here


The Visual Basic Extensibility Model is poorly documented and poorly understood. Yet, it provides the only means of extending the Visual Basic IDE in ways ranging from the simple (like clearing the Immediate window) to the complex. Developing Visual Basic Add-ins addresses this lack of adequate documentation in a book is both a tutorial and a reference guide for developing VB add-ins.

Most developers can think of dozens of ways in which they could work more productively by extending the IDE in some way. But most developers don't have the time to sift through the documentation and experiment through trial and error to find out how to do it. The purpose of this book is to help clarify the subject of creating Visual Basic add-ins. It covers the basics, showing you how to write useful add-ins, and includes lots of simple coding examples.

This book is broken down into two main parts:


Preface

A Visual Basic add-in is a software component that has complete programmatic access to the features of the Visual Basic development environment, officially known as the Visual Basic integrated development environment, or IDE.

If you are like me, you are always looking for ways to perform certain tasks in the VB IDE in a more "natural" way, or simply wishing Microsoft had implemented a certain feature of the IDE in a different manner. In many cases, you can find a way to do what you want using an add-in.

Unfortunately, Microsoft has not brought the issue of creating VB add-ins to the forefront. Indeed, the VB documentation relegates a discussion of add-ins to the later part of the Visual Basic Component Tools Guide. Moreover, the discussion is, shall we say, not as pedagogic as it might be. In addition, amazingly, the VB6 add-in documentation appears to be the same as the VB5 add-in documentation and thus does not reflect the changes made in VB6! (We will discuss these changes, however.)

As further support for Microsoft's disinterest in helping us understand and create add-ins, the MSDN documentation suggests "The easiest way to create an add-in with Visual Basic is to start with the sample provided." This is clearly a copout (which we will avoid).

When I first encountered add-ins under Visual Basic 4, the subject seemed completely shrouded in mystery. I wanted to make some alterations to the VB IDE, in particular to automatically resize code windows, to make keyboard navigation in the VB IDE more natural, and to add block commenting of code. I had to struggle for several days to arrive at an effective add-in.

The purpose of this little book is to help clarify the subject of creating Visual Basic add-ins. It is intended for anyone who has at least a modest acquaintance with Visual Basic-you do not need to be an expert VB programmer.

I do not intend this book to be an encyclopedia on the subject. I will cover the basics, show you how to write useful add-ins, give lots of simple coding examples, and provide you with all of the necessary knowledge to delve into the many darker corners of the subject (which only the folks at Microsoft may fully understand).

I will describe the add-in creation process for Visual Basic version 5 and version 6. Actually, the differences are relatively minor and relate to the initial setup and connection of the add-in rather than to the main programming features. In other words, the extensibility object models for VB5 and VB6 are essentially the same.


Contents

1.  Preface
    Contents
2.  Introduction
    The Add-In Creation Process
    The VB Extensibility Object Model
    The Visual Basic Add-In Template
3.  The Basic Components of an Add-In
    The Add-In Project Itself
    Adding the Connect Class
    Registering an Add-In
    The Add-In Manager and the Add-In Toolbar
    Connecting an Add-In
4.  Object Models
    Collection Objects
    Object Model Hierarchies
    Object Model Syntax
    Object Variables
5.  Menus and Toolbars
    Menus and Toolbars: An Overview
    Menus and Toolbars: The Object Model
    Example: Creating a Menu
    Example: A More Elaborate Menu
    Example: Creating a Toolbar
    Built-In Face IDs
6.  Debugging Add-Ins
    Setting Break Points in an Add-In
    Getting Information From a Running Add-In
7.  Overview of the Object Model
    The VBE and Parent Properties
    Properties and Methods of the VBE Object
    VB IDE Objects
8.  User Interface Objects
    The Window Object
    The CodePane Object
    Example: Clearing the Debug Window
    Example: Scrolling a Code Pane
9.  Project-Related Objects
    VB Projects
    The VBProjects Collection
    The VBProject Object
    Example: Setting the Start Project 
10.  Form and Control Objects
    The VBForm Object
    VBControls Collections
    The VBControl Object
    Example: Setting Tab Stops
11.  Event-Related Objects
    The CommandBarEvents Object
    FileControlEvents
    ReferencesEvents
    SelectedVBControlsEvents
    VBComponentsEvents
    VBControlsEvents
    VBProjectsEvents
    Experimenting with Events
12.  Code-Related Objects
    The CodeModule Object
    The Member Object
    Example: Pushing/Popping Prefixes
13.  Add-In Related Objects
    The AddIns Collection
    The AddIn Object
    Built-In Command Bar Controls
    Face IDs

To order this book through Amazon.com, please click here
Return to Roman Press Home Page
Return to computer books' main page