Manually implementing IDTExtensibility2 A manual implementation of the IDTExtensibility2 interface is required in order to be able to set the Object property on the ComAddin
Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
Application.COMAddIns.Item("MyAddin.Connect").Object = Me
End Sub
A reference is needed to the Microsoft Add-In Designer Type Library (Msaddndr.dll)
Note that the Set keyword is not used here despite Me being an object... Does anyone understand this? With the Set keyword it doesn't work and the addin dies silently. See also: How to build an Office 2000 COM add-in in Visual Basic
http://support.microsoft.com/?kbid=238228 HOWTO: Use a COM Add-In Function as an Excel Worksheet Function
http://support.microsoft.com/kb/256624 OL2000: How to Programmatically Reference a COM Add-in
http://support.microsoft.com/?kbid=240768