Thread: [Solved] Unexpected Macro Behavior
View Single Post
 
Old 03-29-2018, 10:19 AM
RetiredCHE RetiredCHE is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Jun 2016
Location: Alabaster, AL
Posts: 35
RetiredCHE is on a distinguished road
Default Unexpected Macro Behavior

I am running Outlook 2013 in Office 2013 Pro in Windows 10. Everything is fully patched and up to date.

I have written a macro to empty my Trash folder when I quit Outlook. I also put an icon on my QAT to run the macro on demand. The macro runs in both cases, but it only deletes half of the items in the Trash Folder. If I run it a 2nd time on demand it deletes half the remaining items. The macro loops through the items in the folder using a For Each ... Next construct. What am I doing wrong? Below is just the For Each loop of the macro, not the entire macro.

For Each myItem In myTrash
myItem.Delete
Next myItem

Let me know if I need to post the entire macro. Any help will be appreciated!
Reply With Quote