Outlook "pause" NewMailEx

Joined
Feb 18, 2009
Messages
12
Programming Experience
1-3
Hi everyone,

im not sure im in the right section here, so if you need to move this thread, i have absolutely no objections :)

on to my problem:
i have an outlook.application object that i use to process new messages.

here is a snippet of my code:
object used:
Private WithEvents outLookApp As Outlook.ApplicationClass '

form.load
outLookApp = New Outlook.ApplicationClass()

btnStartMonitoring.click
outLookApp = New Outlook.ApplicationClass()

btnStopMonitoring.click <--- THIS IS THE CODE I`M NOT SURE ABOUT
If Not outLookApp Is Nothing Then
outLookApp = Nothing
End If

what i want is a user to click a button that would stop NewMailEx event from triggering. Actually i need my program to detach itself completely from outlook application, so that if you close outlook, OUTLOOK.EXE process would close also. I'm sure i am doing something wrong in the cleanup code. so any help would be very very very welcome. What happens right now is if use click both buttons 5-6 times, it would sort of hang my outlook. and it would not perform properly even after i restart it (ex: takes 15 seconds to close, when normally closes instantaneously)

p.s. also i can't to use .Quit , since it would also close outlook and it is not the desired behavior.

Thanks in advance :)
 
Back
Top