Marco to move files and mark as read

N

Neil1958

1) I can move items to a different folder under Inbox directory but how can I
move them to a directory on the same level as the Inbox.
2) How do I mark thess files as read at the same time as I move them.

Below works for the move but not for a directory on the same level as the
Inbox called "Completed".
Sub NeilMove()
Dim myolApp As New Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myInbox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim myItem As Object
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox)
'Set myInbox = myNamespace.GetDefaultFolder(olFolderCompleted)
Set myItems = myInbox.Items
Set myDestFolder = myInbox.Folders("Saved Mail")
Set myItem = myItems.Find("[SenderName] > 'a'")
While TypeName(myItem) <> "Nothing"
myItem.Move myDestFolder
Set myItem = myItems.FindNext
Wend
End Sub
 
M

Michael Bauer

Am Mon, 19 Sep 2005 18:23:01 -0700 schrieb Neil1958:

1) The NameSpace has also a folders collection. Use that instead of the
Inbox´ folders collection.

2) The MailItem has a Unread property. Set it to False and save the
MailItem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top