Marco to move files and mark as read

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Back
Top