|Determine the "identity" of your emails. Set with SAM the sender, signature and folder for sent items with the help of rules.|
Sometimes it isn't possible to loop through more than about 250 items because Outlook doesn't dispose the object references - although you set the variable explicitly to Nothing. This is also know as memory leak.
To solve the issue ensure the object variable goes out of scope, this will definitely dispose all references.
Public Sub LoopFolder(Folder As Outlook.MAPIFolder) Dim Cnt As Long Dim Limit As Long Dim CountFrom As Long Dim CountTo As Long Dim Done As Long Dim Items As Outlook.Items Set Items = Folder.Items Cnt = Items.Count ' Set the limit per loop Limit = 250 If Cnt <= Limit Then LoopItems Items, 1, Cnt Else Do While Done < Cnt CountFrom = Done + 1 CountTo = Done + Limit LoopItems Items, CountFrom, CountTo Done = CountTo If Done = Cnt Then Exit Do ElseIf Cnt - Done <= Limit Then Limit = Cnt - Done End If Loop End If End Sub Private Sub LoopItems(Items As Outlook.Items, _ ByVal CountFrom As Long, _ ByVal CountTo As Long _ ) Dim i As Long Dim obj As Object Dim Mail As Outlook.MailItem For i = CountFrom To CountTo Set obj = Items.Item(i) If TypeOf obj Is Outlook.MailItem Then Set Mail = obj ' do anythign with the item End If Next End Sub
|Access the master category list in the blink of an eye, share your color categories in a network, get a reminder service, and more.|