Previous Thread:   Hidden VBA code for Outlook

9/19/2005 6:23:01 PM    Marco to move files and mark as read
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



9/20/2005 7:46:19 AM    Re: Marco to move files and mark as read
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.  
  
--  
  
Viele Gruesse / Best regards  
  
Michael Bauer - MVP Outlook  
  
can I