![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I have a real simple function that all it does is Delete messages older than
X days. I'm not sure why, but if I run it once it deletes some of the messages but not all. With 1000's of messages in the folder it may take 3 or 4 runs for it to finally delete all the messages over X days. Is there some problem with CDO where it can only process a small number of messages at one time? Dim NumDaysToDelete NumDaysToDelete = 3 CleanMail(NumDaysToDelete) Sub CleanMail Dim oSession Set oSession = CreateObject("MAPI.Session") strProfileInfo = "cgyex001" & vblf & "ecntrckm" oSession.Logon "", "", False, True, 0, True, strProfileInfo Const CdoDefaultFolderInbox = 1 ' uncomment for VBScript code Dim oFolder Set oFolder = oSession.GetDefaultFolder(CdoDefaultFolderInbox) Dim oMessages Set oMessages = oFolder.Messages For Each oMessage In oMessages If DateDiff("d",oMessage.TimeReceived,now) = NumDaysToDelete Then oMessage.Delete End if Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
BCC Question | CWLee | Outlook Express | 3 | November 12th 07 09:49 PM |
Question on CIW | Abhi | Outlook - Installation | 0 | August 12th 07 07:46 PM |
set-up question | Savvy3 | Outlook - General Queries | 3 | February 23rd 07 08:21 PM |
question | Steve Baker | Outlook - Using Forms | 1 | September 5th 06 09:31 PM |
Another Question. | Bewildered | Outlook - Using Contacts | 3 | August 22nd 06 02:51 AM |