A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Code to move task from inbox to a task folder



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 17th 08, 08:06 PM posted to microsoft.public.outlook.program_vba
LDMueller
external usenet poster
 
Posts: 53
Default Code to move task from inbox to a task folder

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.
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 simple macros - create task from email and move email to folder [email protected] Outlook and VBA 5 February 4th 07 09:57 AM
How do I move a Daily Task to the Master Task List? Carol Outlook - General Queries 0 November 17th 06 05:57 PM
Can not open "task request" "task accepted" in Inbox LaParker Outlook - General Queries 2 August 9th 06 10:09 PM
Task 'Hotmail: Folder:Inbox Synchronizing headers.' reported error (0x80004005) baduser Outlook - General Queries 4 July 21st 06 09:46 AM
VBA Code to check Task Status [email protected] Outlook and VBA 2 February 3rd 06 06:16 PM


All times are GMT +1. The time now is 05:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.