Hi,
I am facing a very weird problem.
Below is my code.
My intention is to process and move all the mails in my inbox to another folder.
My code work perfectly fine before i putting in my move item function.
It able to process all the msg without fails in inbox until i put in the move function.
After the move function in, it seems like it only return me partial of the inbox item
******************************************
Dim ol As Outlook.Application
Set ol = CreateObject("Outlook.Application")
Dim fd As Outlook.MAPIFolder
Dim ns As Outlook.NameSpace
Dim itms As Outlook.Items
Dim itm As Object
'Get to the current session of Outlook
Set ns = ol.GetNamespace("MAPI")
'Retrieve a collection of mail messages in the Inbox
Set itms = ns.GetDefaultFolder(olFolderInbox).Items
For Each itm In itms
' i use this read flag to test if it did return me all the items in inbox.
itm.UnRead = False
' 2 = the mailbox index, 7 = movefolder index
' if i disable/remove this code, all items in inbox will be marked as read, but if i enable the code below. only some of the code will be moved and marked as read.
itm.Move (ns.Folders(2).Folders(7))
Next
******************************************
I am facing a very weird problem.
Below is my code.
My intention is to process and move all the mails in my inbox to another folder.
My code work perfectly fine before i putting in my move item function.
It able to process all the msg without fails in inbox until i put in the move function.
After the move function in, it seems like it only return me partial of the inbox item
******************************************
Dim ol As Outlook.Application
Set ol = CreateObject("Outlook.Application")
Dim fd As Outlook.MAPIFolder
Dim ns As Outlook.NameSpace
Dim itms As Outlook.Items
Dim itm As Object
'Get to the current session of Outlook
Set ns = ol.GetNamespace("MAPI")
'Retrieve a collection of mail messages in the Inbox
Set itms = ns.GetDefaultFolder(olFolderInbox).Items
For Each itm In itms
' i use this read flag to test if it did return me all the items in inbox.
itm.UnRead = False
' 2 = the mailbox index, 7 = movefolder index
' if i disable/remove this code, all items in inbox will be marked as read, but if i enable the code below. only some of the code will be moved and marked as read.
itm.Move (ns.Folders(2).Folders(7))
Next
******************************************