Outlook won t close

broken image

LblEMailHitCount.Text = 'Hits: ' & eMailMoveCountĪccording to your description, I have found that you have created multi Outlook.Application object. TbResponse.Text = tbResponse.Text + 'eMail Moved -> From: ' & & ' Subject: ' & mail.Subject & vbNewLine If strMoveBy.Contains(MoveIfContains) Then FinalReleaseComObject(olapp)ĭim fldInbox As Outlook.MAPIFolder = olapp.GetNamespace('mapi').GetDefaultFolder()ĭim fldDestination = fldInbox.Folders(DestinationFolder)ĭim fldRoot As Outlook.MAPIFolder = fldInbox.ParentįldDestination = fldInbox.Folders(DestinationFolder)ĭim vItems As Outlook.Items = fldInbox.Itemsĭim mail As Outlook.MailItem = Tr圜ast(vItems.Item(i), Outlook.MailItem)ĭim strMoveBy As String = WriteLinetoLog(strLogPath, ' /move close: ' & ex.Message) If String.Compare(arg, '/move', True) = 0 Then LblEMailCount.Text = 'eMail Count: ' & eMailCount NParent = (0, 'From: ' & & ' Subject: ' & mail.Subject) thoughts? any help is greatly appreciated!įull Code snippet: Private Sub BtnGeteMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGeteMail.Clickĭim mapi As Outlook.MAPIFolder = olapp.GetNamespace('mapi').GetDefaultFolder()įor Each mail As Outlook.MailItem In mapi.Items

broken image
broken image

Olapp = Nothing, Close() still leave it running.

broken image

the below olapp.quit(), (), .ReleaseComObject(olapp), .FinalReleaseComObject(olapp), I have this working code, but when I execute command line it leave application still running in task manager.