outlook com add on

D

dorling

hi there,

i got a COM add-in and it loads fine in to outlook but if i add the
following line of code so that i can call a function from an outlook form it
doesn't load at all?

application.COMAddIns.Item("DMCRM.Connect").Object = Me

i got this info from http://support.microsoft.com/?kbid=240768

My code is below and the function i am trying to call is tester

thanks a lot any help please

Jonathan

Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Outlook
Imports Extensibility
Imports System.Runtime.InteropServices


#Region " Read me for Add-in installation and setup information. "
' When run, the Add-in wizard prepared the registry for the Add-in.
' At a later time, if the Add-in becomes unavailable for reasons such as:
' 1) You moved this project to a computer other than which is was
originally created on.
' 2) You chose 'Yes' when presented with a message asking if you wish to
remove the Add-in.
' 3) Registry corruption.
' you will need to re-register the Add-in by building the DMCRMSetup project
' by right clicking the project in the Solution Explorer, then choosing
install.
#End Region

<GuidAttribute("572C0332-5D4C-4BF3-B8E4-943F860399B8"),
ProgIdAttribute("DMCRM.Connect")> _
Public Class Connect

#Region "Var"

Implements Extensibility.IDTExtensibility2

'
'
'
Dim applicationObject As Object
Dim addInInstance As Object


#End Region

#Region "COM add-in"

Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnBeginShutdown
On Error Resume Next
' Notify the user you are shutting down, and delete the button.
MsgBox("Our custom Add-in is unloading.")

End Sub

Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
'
End Sub

Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
MsgBox("Our custom Add-in is loading.")

End Sub

Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnDisconnection
On Error Resume Next

If RemoveMode <>
Extensibility.ext_DisconnectMode.ext_dm_HostShutdown Then _
Call OnBeginShutdown(custom)

applicationObject = Nothing
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal connectMode
As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
applicationObject = application
addInInstance = addInInst

' If you aren't in startup, manually call OnStartupComplete.
If (connectMode <> Extensibility.ext_ConnectMode.ext_cm_Startup)
Then _
Call OnStartupComplete(custom)



End Sub

#End Region

Public Function Tester()
MsgBox("testing 1 2 3")
End Function

End Class
 
M

Mike Walker [MVP]

I cant see anything wrong in the code you have supplied accept I can't see
when you are assigning the Internal Comaddins to me. This line is fine and
we use this for our addins albeit we haven't got any outlook code coming
back the other way but we have done this for Word and Excel without failure.

Can you highlight where you are doing the assignment. We cast the
application into a type of Outlook.Application and then run from this which
may assist.

Regards

Mike Walker MVP
Visual Developer VSTO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top