Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
Excel COM add-ins and Automation add-ins
Article ID: 291392 - View products that this article applies to.
This article was previously published under Q291392
Microsoft Office Excel 2002 and Microsoft Office 2007 support Automation Add-ins in addition to Component Object Model (COM) Add-ins. This article explains the differences between these two types of Add-ins.
COM Add-insCOM Add-ins present the developer with a way to extend the functionality of Office 2000, Office XP, Office 2003 and Office 2007 applications for custom tasks. COM Add-ins are typically used to automate Excel in response to a click of a CommandBar button, a form or dialog box, or some other event specific to Excel such as opening or closing workbooks or entering data on worksheets. COM Add-in functions cannot be directly called from cell formulas in worksheets.
A COM Add-in is an in-process COM server (an ActiveX DLL) that must implement the IDTExensibility2 interface. All COM Add-ins must implement each of the five methods of this interface: OnConnection, OnStartupComplete, OnAddinsUpdate, OnBeginShutDown, and OnDisconnection.
When a COM Add-in is installed on a user's system, registry entries are created for the Add-in. In addition to normal COM registration, a COM Add-in is registered for each Office application in which it runs. COM Add-ins used by Excel are registered in the following registry key:
This key contains a subkey for each installed COM Add-in. The name of the subkey is the ProgID for the COM Add-in. The subkey for a COM Add-in also contains values that describe the COM Add-in's friendly name, description, and load behavior. The load behavior describes how the Add-in is loaded in Excel: loaded at startup, loaded at next startup only, loaded on demand, or not loaded.
COM Add-ins can also be loaded and unloaded through the Excel 2002 user interface. To do this, follow these steps:
(http://support.microsoft.com/kb/238228/ )HOWTO: Build an Office 2000 COM Add-In in Visual Basic
230689For more information, see the following Microsoft Web site:
(http://support.microsoft.com/kb/230689/ )SAMPLE: Comaddin.exe Office 2000 COM Add-In Written in Visual C++
Automation Add-insIn addition to COM Add-ins, Excel 2002, and Excel 2003 supports Automation Add-ins. Automation Add-ins build on COM Add-ins in that functions in Automation Add-ins can be called from formulas in Excel worksheets. COM Add-ins must be in-process COM servers that support the IDTExtensibility2 interface; however, Automation Add-ins can be in-process or out-of-process COM servers and implementation of IDTExtensibility2 is optional.
To use functions from an Automation Add-in in Excel, follow these steps:
The /A switch that is used in the string value is new to Excel 2002 / Excel 2003 and is used specifically to load Automation Add-ins. All Automation Add-ins are loaded on demand; there is no setting that can change the load behavior for an Automation Add-in.
Excel 2002 Key: HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Excel\Options String: OPENx Sample Value: /A "ServerName.ClassName" Excel 2003 Key: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options String: OPENx Sample Value: /A "ServerName.ClassName" Excel 2007 Key: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Options String: OPENx Sample Value: /A "ServerName.ClassName"
When an Automation Add-in that is listed in the Add-Ins dialog box is cleared, a subkey with a name equal to the Add-in's ProgID is created in the following registry key:
Excel 2002:This registry setting ensures that Automation Add-ins that you have added to the Add-ins list are retained in the list even when you have chosen not to load them.
HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Excel\Add-in Manager Excel 2003: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Add-in Manager
For more information about Automation Add-Ins, see the following articles in the Microsoft Knowledge Base:
285337For more information, see the following Microsoft Web site:
(http://support.microsoft.com/kb/285337/ )HOWTO: Create a Visual Basic Automation Add-in for Excel Worksheet Functions
Automation Add-ins That Implement IDTExtensibility2As previously mentioned, an Automation Add-in may implement IDTExtensibility2, but it is not required in order for Excel to call the functions in the Add-in from a worksheet. If you require that your Automation Add-in obtains a reference to the Excel instance, you can implement IDTExtensibility2 and use the Application parameter of OnConnection to automate Excel.
An Automation Add-in that implements IDTExtensibility2 can be loaded in the Excel user interface through both the COM Add-Ins dialog box and the Add-Ins dialog box. The following describes the behavior of an Automation Add-in based on whether it is loaded in one or both of these dialog boxes:
284876(c) Microsoft Corporation 2001, All Rights Reserved. Contributions by Lori B. Turner, Microsoft Corporation.
(http://support.microsoft.com/kb/284876/ )BUG: Excel Fails When Automation Add-In Loads