hi all,
I've written a script that loops through all the emails in my inbox and, if a folder exists that match the simle criteria it moves it there. for some strange reason after going through a few time the Email object becomes nothing and i cant work out why. Oddly enough if i wait a few seconds i can continue with the code (simply pressing f5.)
thanks for any helpPrivate Sub loop_test() Set objNS = GetNamespace("MAPI") Set objinbox = objNS.GetDefaultFolder(olFolderInbox) Set objFolder = objNS.GetDefaultFolder(olFolderInbox).Folders("Opportunities").Folders("Customers") Dim currenttime As Date For Each Email In objinbox.Items For Each SubFolder In objFolder.Folders If InStr(Email.subject, SubFolder.Name) Then Email.Move SubFolder End If Next SubFolder Next Email End Sub


Reply With Quote
