Results 1 to 8 of 8

Thread: [RESOLVED] Outlook NewEmailEx event won't fire in small VB6 application

Threaded View

  1. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Outlook NewEmailEx event won't fire in small VB6 application

    First thing I'd do is to remove the 'On Error Resume Next' statement as it may be ignoring a significant error.

    Next thing I'd do is to change the Initialize_Handler to read
    Code:
    Set OutlookApplication = New Outlook.Application
    and see what happens.

    EDIT: On reflection, I'd remove the Initialise_Handler sub routine altogether (as I don't think it'll ever be executed by VB6 - it might work in VBA - I don't know) and replace it with
    Code:
    Private Sub Class_Initialize()
    Set OutlookApplication = New Outlook.Application
    End Sub
    Also I'd get rid of the Form_Initialise event altogether, and modify the Form_Load to:
    Code:
    Private Sub Form_Load
    Set myEmailMonitor = New Class1
    End Sub
    You could also have a 'terminate' sub routine to shutdown Outlook and tidy up
    Code:
    Private Sub Terminate
    Set OutlookApplication = Nothing
    Set MyEmailMonitor = Nothing
    End Sub
    change Command1_Click to
    Code:
    Private Sub Command1_Click
    Terminate
    Unload me
    End Sub
    and the Query_Unload event to
    Code:
    Private Sub Query_Unload
    Terminate
    End Sub
    Last edited by Doogle; Apr 6th, 2013 at 05:43 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width