Thread: [Solved] Rule on Category Change
View Single Post
 
Old 08-29-2011, 06:15 AM
ker09 ker09 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Aug 2011
Posts: 2
ker09 is on a distinguished road
Default

Anybody got any VBA or other ideas? I'm familiar with VBA in Excel, but not with Outlook terminology.

I've got this code, but it breaks on the line indicated. i don't know how to name the folders

Sub MoveItems()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myBox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim myItem As Object
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myBox = myBox.Folders("!PS-In-Florida")
'was: myNameSpace.GetDefaultFolder (olFolderInbox)

Set myItems = myInbox.Items
Set myDestFolder = myInbox.Folders("PS-Completed Items")
Set myItem = myItems.Find("[Category] Like '*Done*'")
While TypeName(myItem) <> "Nothing"
myItem.Move myDestFolder
Set myItem = myItems.FindNext
Wend
End Sub

Last edited by ker09; 08-29-2011 at 10:11 AM.
Reply With Quote