S
S1lverface
In my Sent Items I have a Subfolder called LEVEL 1. Below this I drill down
to a sub subfolder called Level 1.1. I want the code below to move mail from
Sent Items box to the Level 1.1 Folder but it doesn't find the folder,
although it exists
Can you help?
Thanks
S1lverface
_________
Sub MoveSentItems()
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(olFolderSentMail)
Set myItems = myInbox.Items
Set myDestFolder = myInbox.Folders("Level 1.1")
Set myItem = myItems.Find("[To] = 'John Brody'")
While TypeName(myItem) <> "Nothing"
myItem.Move myDestFolder
Set myItem = myItems.FindNext
Wend
End Sub
to a sub subfolder called Level 1.1. I want the code below to move mail from
Sent Items box to the Level 1.1 Folder but it doesn't find the folder,
although it exists
Can you help?
Thanks
S1lverface
_________
Sub MoveSentItems()
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(olFolderSentMail)
Set myItems = myInbox.Items
Set myDestFolder = myInbox.Folders("Level 1.1")
Set myItem = myItems.Find("[To] = 'John Brody'")
While TypeName(myItem) <> "Nothing"
myItem.Move myDestFolder
Set myItem = myItems.FindNext
Wend
End Sub