Problem: VB.NET Outlook Addin - declare new application object

From: Jeanine (Jeanine_at_discussions.microsoft.com)
Date: 03/07/05


Date: Mon, 7 Mar 2005 04:11:03 -0800

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



Relevant Pages

  • Re: Help needed on creating a subform
    ... Don't enter anything in this procedure yet but scroll down below the End Sub ... "ORDER BY QuoteId DESC, Keyword" ... based on the current value of the quote id. ... A UNION query concatenates the results of two separate queries. ...
    (microsoft.public.access.forms)
  • RE: Module help
    ... Public Sub Test() ... The only time a subroutine in a standalone module is ... Private Sub Test() ... the Private keyword. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Module help
    ... You may be having problems with scope. ... Public Sub Test() ... The only time a subroutine in a standalone module is ... the Private keyword. ...
    (microsoft.public.access.modulesdaovba)
  • Re: error cannot user parentheses when calling a sub
    ... Optional keyword. ... The engine accepts "Call HomeDir", ... You can transfer control to a Sub or Function procedure using the Call ... enclose any parameters in parentheses, and if you omit the Call key ...
    (microsoft.public.scripting.vbscript)
  • RE: Delete Column having specific word/value
    ... Sub DeleteColumsWithKeyword() ... Dim Keyword As String, DefaultKeyword As String ...
    (microsoft.public.excel.programming)