Quantcast
Channel: Outlook IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 33562

For Each loop with Email Items exiting after one item

$
0
0

I have the following VBA code that won't loop. It will delete the first item and then move on. I checked the count property of fldrFolder.Items and it shows several there: (strange that VBA isn't a choice when inserting a code block)

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


Viewing all articles
Browse latest Browse all 33562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>