G
Guest
I have a vb.net outlook addin with the following problem. I have to use the
NEW keyword when declaring my Outlook.Application object. I don't think I
should be using the new keyword, as in all the samples I have look at you
just set a reference to the application object parsed into the connect
procedure. If I don't use the New keyword then I get "object reference not
set" errors.
The reason I'm concerned about this is because when Outlook closes, it takes
quite a while to close fully when my addin is installed. I'm wondering if
having to declare the application as new is the cause of this.
Here is a sample of my code:
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
Dim oApp As Outlook.Application
....
oApp = CType(application, Outlook.Application)
....
m_BaseClass.InitHandler(oApp, MyProgID)
....
End Sub
Public Class OutAddin
Dim WithEvents objOutlook As New Outlook.Application
Friend Sub InitHandler(ByVal oApp As Outlook.Application, ByVal strPID As
String)
Try
objOutlook = oApp
....
Any suggestions would be appreciated.
Thanks
Jeanine
NEW keyword when declaring my Outlook.Application object. I don't think I
should be using the new keyword, as in all the samples I have look at you
just set a reference to the application object parsed into the connect
procedure. If I don't use the New keyword then I get "object reference not
set" errors.
The reason I'm concerned about this is because when Outlook closes, it takes
quite a while to close fully when my addin is installed. I'm wondering if
having to declare the application as new is the cause of this.
Here is a sample of my code:
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
Dim oApp As Outlook.Application
....
oApp = CType(application, Outlook.Application)
....
m_BaseClass.InitHandler(oApp, MyProgID)
....
End Sub
Public Class OutAddin
Dim WithEvents objOutlook As New Outlook.Application
Friend Sub InitHandler(ByVal oApp As Outlook.Application, ByVal strPID As
String)
Try
objOutlook = oApp
....
Any suggestions would be appreciated.
Thanks
Jeanine