L
LDMueller
I'm trying to automate my Outlook mailbox so when a task appears in my inbox
with the subject
starting with "Please consider" that it is moved to my task folder named
"AAA".
My direction is that I've created an Outlook Rule whose criteria is having
"Please consider" in
the subject and then it runs a script.
The script needs to move the task for me, but this is where I'm having
problems since I'm
limited to what I know.
Below is my snippet which only works if I go into the task folder, highlight
all the entries
and run the code.
Sub MoveTaskToFolder()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.TaskItem
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Parent.Folders("AAA")
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olTaskItem Then
objItem.Move objFolder
End If
Next
Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
Can anyone help me with this.
with the subject
starting with "Please consider" that it is moved to my task folder named
"AAA".
My direction is that I've created an Outlook Rule whose criteria is having
"Please consider" in
the subject and then it runs a script.
The script needs to move the task for me, but this is where I'm having
problems since I'm
limited to what I know.
Below is my snippet which only works if I go into the task folder, highlight
all the entries
and run the code.
Sub MoveTaskToFolder()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.TaskItem
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Parent.Folders("AAA")
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olTaskItem Then
objItem.Move objFolder
End If
Next
Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
Can anyone help me with this.