Article ID: 316983 - View products that this article applies to.
This article was previously published under Q316983
This article describes how to use Microsoft Visual Basic 6.0 and its standard add-in template to create an Outlook Component Object Model (COM) add-in. The sample add-in implements the Outlook ItemSend event, so that you can save specific sent-mail messages to a folder other than the Sent Items folder.
Microsoft Office 2000 (and later) supports COM add-ins. Developers can use COM add-ins to create add-ins that enhance and control Office programs. One of the key advantages of COM add-ins is that they provide a uniform design architecture to build Office add-ins.
COM Add-in EventsIn most Outlook add-ins, you use the following two key events.
The "OnConnection" EventThe OnConnection event starts when the COM add-in is connected. The add-in can be connected when Outlook starts, by the user, or by using automation in Outlook. If the OnConnection event returns successfully, the add-in is considered loaded. Otherwise, the reference to the add-in is released and destroyed by the host application.
The OnConnection event has the following four parameters:
The "OnDisconnection" EventThe OnDisconnection event starts after the COM add-in is disconnected and before the COM add-in unloads from memory. This event contains all of the cleanup that is required and restores any changes that are made to the host application.
The OnDisconnection event has the following two parameters:
Creating the COM Add-inThis section describes how to create a COM add-in that moves sent mail to a folder other than the default Sent Items folder. The COM add-in moves sent mail based on subject of the message. You cannot use the Outlook rules wizard to implement this type of rule.
To create a COM add-in that moves sent mail to a folder other than the default Sent Items folder:
Loading the COM Add-inTo load the COM add-in in Outlook, click Options on the Tools menu. Click the Other tab, click Advanced Options, and then click COM Add-Ins. Click Add, locate the .dll file that you compiled, and then click OK.
Distributing the COM Add-inA COM add-in has to be registered on every computer on which the COM add-in will be used. You can typically distribute the add-in one of two ways:
For additional information about how to write COM add-ins, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/291163/EN-US/ )OL2002: How to Create a COM Add-in for Outlook
(http://support.microsoft.com/kb/230225/EN-US/ )OL2000: How to Create a COM Add-in for Outlook
(http://support.microsoft.com/kb/238228/EN-US/ )HOWTO: Build an Office 2000 COM Add-In in Visual Basic
(http://support.microsoft.com/kb/302896/EN-US/ )HOW TO: Build an Office COM Add-in With Visual Basic .NET
190253For additional information about available resources and answersto frequently asked questions about Microsoft Outlook solutions, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/190253/EN-US/ )INFO: VB6 Designers Do Not Work in VB5
(http://support.microsoft.com/kb/287530/EN-US/ )OL2002: Questions About Custom Forms and Outlook Solutions
(http://support.microsoft.com/kb/146636/EN-US/ )OL2000: Questions About Custom Forms and Outlook Solutions
(http://support.microsoft.com/kb/182349/EN-US/ )OL98: Questions About Custom Forms and Outlook Solutions
(http://support.microsoft.com/kb/170783/EN-US/ )OL97: Questions About Customizing or Programming Outlook