Sounds like a solution Naomi - i'm a little confused as to where i would stick it. my initial path is going through 'all' emails and sifting through the unread via 'if' command. would i somehow insert your clause into the 'if' area or include it in the nitiatial the search for 'all' emails?
For Each loMSG In loInBox.Items
If loMSG.UnRead
endif
endfor
for lnI = Messages.Count to 1 step -1
next
>I'm thinking you may have an error in your logic and that's why the e-mails are missing.
>
>Try using
>
>for lnI = Messages.Count to 1 step -1
>next
>
>loop, e.g. do it backwards.
>
>>good idea! - alas niether worked
>>loNameSpace.Folders("Personal Folders").Folders.Remove('TempBox')
>>loNameSpace.Folders("Personal Folders").Folders.Delete('TempBox')
>>
>>Perhaps there is a better way to deal with the problem i'm trying to overcome. Here is problem: When i move emails to a folder called 'processed' there are always a couple of unread emails left in the inbox. i suspect the automation looses it's place when it moves to another folder and skips emails in the inbox.
>>so my iniitial idea was to count unread - and if number was not at 0, have the program loop and go through the lot again. to do this i have to move irrelevant emails into a folder called "tempbox" then move them back after completing processing.
>>
>>Perhaps you can think of a more efficient way of dealing with the initial problem (of missing unread) to save me creating a new folder.
>>
>>thanks for the tries and thoughts.
>>
>>k
>>
>>
>>>>I have successfully created a folder called "TempBox". How do i delete this folder after i have finished?
>>>>
>>>>thanks for all the help.
>>>>k
>>>>
>>>>
>>>>Local loOutlook As Outlook.Application
>>>>Local loNameSpace As Outlook.NameSpace
>>>>Local loInBox As Object
>>>>Local loMSG As Outlook.MailItem
>>>>Local lnUnRead As Integer
>>>>Local loAttach,llAttach
>>>>
>>>>#Define olFolderInBox 6
>>>>
>>>>loOutlook = Createobject('Outlook.Application')
>>>>loNameSpace = loOutlook.GetNamespace("MAPI")
>>>>loInBox = loNameSpace.GetDefaultFolder(olFolderInBox)
>>>>lnUnRead = 0
>>>>
>>>>Local loNewFolder
>>>>
>>>>loNewFolder=loNameSpace.Folders("Personal Folders").Folders.Add('TempBox')
>>>>
>>>>
>>>
>>>Sorry, try
>>>
>>>loNameSpace.Folders("Personal Folders").Folders.Remove('TempBox')