tbaker818
03-28-2013, 12:11 PM
I have the following VBA code that won't loop. It does what it's supposed to do, but only for the first item. I checked the count property of fldrFolder.Items and it shows several there:
(why do the VBA tags put all of my code on one line?)
Dim appOutlook As New Outlook.Application
Dim nsMAPI As Outlook.Namespace
Dim fldrInbox As Outlook.Folder
Dim fldrFolder As Outlook.Folder
Dim miEmail As Outlook.MailItem
Set nsMAPI = appOutlook.GetNamespace("MAPI")
Set fldrInbox = nsMAPI.GetDefaultFolder(olFolderInbox)
Set fldrFolder = fldrInbox.Folders("LEAP Updates")
For Each miEmail In fldrFolder.Items
miEmail.Delete
Next miEmail
(why do the VBA tags put all of my code on one line?)
Dim appOutlook As New Outlook.Application
Dim nsMAPI As Outlook.Namespace
Dim fldrInbox As Outlook.Folder
Dim fldrFolder As Outlook.Folder
Dim miEmail As Outlook.MailItem
Set nsMAPI = appOutlook.GetNamespace("MAPI")
Set fldrInbox = nsMAPI.GetDefaultFolder(olFolderInbox)
Set fldrFolder = fldrInbox.Folders("LEAP Updates")
For Each miEmail In fldrFolder.Items
miEmail.Delete
Next miEmail