01-08-2009, 04:25 PM
Hi Ankur,
how to check and close the all unread mails in outlook for this i tried some code, in this code loop is working fine.but its not reading unread mails and its taken only old mails.Please assist me on this.
My Code is :
Thanks,
prasad
prasad.vengala@gmail.com
how to check and close the all unread mails in outlook for this i tried some code, in this code loop is working fine.but its not reading unread mails and its taken only old mails.Please assist me on this.
My Code is :
Code:
Dim myOlApp,myFolder,strFilter,sTot_UnRed_mails
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
On Error Resume Next
Set myFolder= myNameSpace.GetDefaultFolder(6)
sTot_UnRed_mails= myFolder.UnReadItemCount
'strFilter = "[UnRead] = True"
'Set ObjResMail_Items =ObjMail_Items.Restrict( strFilter )
'ObjResMail_Items.Sort "[UnRead]",True
For i= 1 to sTot_UnRed_mails
If InStr(myFolder.Subject,sSubject) > 0 Then
Set oItem = myFolder.Items(i)
sSubject = oItem.Subject
sBody = oItem.Body
Reporter.ReportEvent micPass,"",""&sBody
myFolder.UnRead = False
End If
Next
Thanks,
prasad
prasad.vengala@gmail.com