For Each loop: How to adjust code to move files in one run rather than multiple

后端 未结 1 1960
一个人的身影
一个人的身影 2020-12-12 06:24

I am using the below code to archive emails that have been marked completed. It is supposed to check all emails in our shared folder for anything marked complete prior to t

相关标签:
1条回答
  • 2020-12-12 06:52

    Do not use "for each" loop if you are modifying the collection

    Change the loop

    For Each oMailItem In oSource.Items
    

    to a down "for" loop:

    dim oItems = oSource.Items
    for I = oItems.Count to 1 step -1
      set oMailItem  = oItems.Item(I)
    
    0 讨论(0)
提交回复
热议问题