PC Review

Thread Tools Rate Thread

Looping through items in Outlook Inbox and moving them

Jake Cole
Posts: n/a
      20th Aug 2004
When using this code to loop through ALL the items in an Outlook
Inbox, instead of moving every item, the code moves exactly half of
the mail items each time it is run

Here is the current code. I would like the code to move all inbox
items to the "completed" folder, -instead of just half, can anyone
tell me what the problem is with this code?! (This code is run from
within an access database.)

Dim mapiNameSpace As Outlook.NameSpace
Dim fldInbox As MAPIFolder
Dim newMail As MailItem
Dim fldMoveTo As MAPIFolder
Dim myTime
Dim olO As Outlook.Application
Dim sFolder As Outlook.Recipient

Set olO = New Outlook.Application
Set mapiNameSpace = olO.GetNamespace("MAPI")
Set sFolder = mapiNameSpace.CreateRecipient("Conference 2004")
Set fldInbox = mapiNameSpace.GetSharedDefaultFolder(sFolder,
Set fldMoveTo = fldInbox.Folders("Completed")
cm = 0
MsgBox fldInbox.Items.Count
For Each newMail In fldInbox.Items
cm = cm + 1
newMail.Move fldMoveTo
MsgBox cm & " Records Moved!"
End Sub

Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted Microsoft ASP .NET 0 6th Jan 2008 05:45 AM
Looping through CheckBoxList items doesn't pick up selected ones when items were disabled Bart Van Hemelen Microsoft ASP .NET 2 4th Sep 2006 09:35 AM
Looping through items in Inbox and moving them Jake Cole Microsoft Outlook VBA Programming 1 20th Aug 2004 07:41 PM
Looping Through Items in Outlook Inbox Then Moving Them Jake Cole Microsoft Access Form Coding 1 20th Aug 2004 06:52 PM
Moving folders - and how to stop "them" from moving "them". Ian Livesey Microsoft Windows 2000 1 18th Jul 2003 07:22 PM




All times are GMT +1. The time now is 05:33 AM.