Downloads
45650.zip

I have an Outlook 2002 rule to handle messages that I receive as a member of a particular distribution list (DL). The rule copies each message to one folder, moves it to another folder, and prints it. I want to do one more thing with these messages: Create a task from them in my Tasks folder. Can I use a rule to do that?

You probably already realize that there's no rule action built into the Outlook Rules Wizard to create a new item of a different type according to information in an incoming message. However, what you want to do is a good candidate for the run a script rule action that Microsoft Office Outlook 2003 and Outlook 2002 support. Listing 2 shows a Visual Basic for Applications (VBA) procedure that creates a new task, copies the subject and body from the message to the task, sets the task's due date to the date the message was sent, then copies any attachments and saves the task. Notice that the procedure can't copy attachments directly. Instead, the code must save them to a system folder, then attach the saved file.

What makes this procedure a script suitable for use in the Rules Wizard's run a script action is that it's a public subroutine with a MailItem object as its only argument. (You can also make rule procedures to process MeetingItem objects—that is, meeting requests.) When you create a rule and choose the run a script action, you should see Project1.MakeTaskFromMail listed as an available script. (Project1 is the overall name of the VBA project.)