For Each loop not deleting all items
问题 I have a macro which is supposed to delete emails over 'x' amount of days old when I quit Outlook 2007 but it only seems to delete a few of them and when I open it and quit again it deleted the rest. Here is the code: Private Sub Application_Quit() Dim myOlApp, myNameSpace As Object Dim MyItem As Object Dim DeletedFolder As Object Set myOlApp = CreateObject("Outlook.Application") Set myNameSpace = myOlApp.GetNamespace("MAPI") 'Set DeletedFolder = myNameSpace.GetDefaultFolder