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
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