PDA

View Full Version : Delete emails after attachments are saved



dayjam
04-07-2010, 06:28 AM
Hi,

I have the code below which is saving attachments from an Outlook subfolder to a directory. Once these attachments are saved I want to delete the emails.

I've been told to use Item.Delete but the loop isn't working, it only picks up the first mail and then moves onto the rest of the code.

Any ideas how to get around this?

Here is the loop:

'Saves email attachments
For Each Item In SubFolder.Items
For Each Atmt In Item.Attachments
If Right(Atmt.FileName, 3) = "xls" Then
FileName = "N:\Investment\Performance Measurement\PERFMEAS - NUIM\EQUITY\CFD\59065\" & Atmt.FileName
Atmt.SaveAsFile FileName
Item.Delete
i = i + 1

End If
Next Atmt

Next Item





Thanks

JP2112
04-23-2010, 09:56 AM
See your other thread.