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
and see what happens.Code:Set OutlookApplication = New Outlook.Application
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
Also I'd get rid of the Form_Initialise event altogether, and modify the Form_Load to:Code:Private Sub Class_Initialize() Set OutlookApplication = New Outlook.Application End Sub
You could also have a 'terminate' sub routine to shutdown Outlook and tidy upCode:Private Sub Form_Load Set myEmailMonitor = New Class1 End Sub
change Command1_Click toCode:Private Sub Terminate Set OutlookApplication = Nothing Set MyEmailMonitor = Nothing End Sub
and the Query_Unload event toCode:Private Sub Command1_Click Terminate Unload me End Sub
Code:Private Sub Query_Unload Terminate End Sub




Reply With Quote
