• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Create a Task and copy to another Tasks folder

Slipstick Systems

› Developer › Create a Task and copy to another Tasks folder

Last reviewed on January 4, 2018     2 Comments

This macro was originally written to work around an issue with the "old" Outlook.com server but now that Outlook.com is hosted on Office 365, Tasks work "as expected" and fully support attachments. However, you can use this method to copy Tasks (or with a little tweaking, other Outlook items) to another folder in your profile.

My work flow –
1) Receive an email with an attachment that I have to review
2) Create task with the attachment shortcut
3) When I’m ready to work the item I can just open the task, click on the attachment and start reviewing.
Now I have to use the create task with text, then go back to find the original email to find the attachment ….

There are two macros on this page. The first macro creates a task with a text link to the original message. This method can be used with iCloud addin to link to the original message in your mailbox. (The link will only work in Outlook, not from your iPhone.)

The second macro creates a task in a local task folder (that supports attachments) and creates a copy of the task (without the attachment) in another task folder.

Create a button on the ribbon or QAT for the macro so its easy to use.

If you have Outlook configured to set reminders on tasks with a due date, a reminder will be set. If you aren't using default reminders or want to use a different reminder, see the Set Reminder section at the end.

To create appointments instead, change each instance of TaskItem to AppointmentItem and change the field names to ones supported by appointments.

 

Create a Link to the message

A link in the body does not work with Outlook.com, due to it's lack of support for rich text bodies, so I put the link in the subject. Yes, it's ugly, but it works. You could put the link in the body, but it won't be clickable. (The code snippet at the end of this page inserts a hyperlink.)

To use this macro you need to:

  1. Set macro security to low during testing. You can sign it using selfcert later.
  2. Open VBA Editor using Alt+F11
  3. Right click on Project1 and choose Insert > Module.
  4. Paste the code into the module.
  5. Select a message, run the macro. Note: if you select more than one message, it creates a task for each message.

Sub ConvertMessagetoTask()
    Dim objTask As Outlook.TaskItem
    Dim objMail As Outlook.mailItem
    Dim strID As String
    Dim strLink, strLinkText As String

For Each objMail In Application.ActiveExplorer.Selection

    strID = objMail.EntryID
    strLink = "outlook:" & strID
    strLinkText = objMail.Subject 

Set objTask = Application.CreateItem(olTaskItem)
With objTask
    .Subject = strLinkText  & " " & strLink
    .DueDate = objMail.ReceivedTime + 3
    .StartDate = objMail.ReceivedTime + 2
    .Body = objMail.Body
    .Categories = "my category"
    .Save
End With

    Next
 
    Set objTask = Nothing
    Set objMail = Nothing
End Sub

 

Create two tasks from message

This macro creates two tasks for each selected message(s). The first task includes the original message as an attachment and saves it to a Tasks folder that supports attachments. It then creates a second task with only the message body in the task and saves it to the default Tasks folders.

In addition, the EntryID of the local task which contains the attachment is added to the Subject field (so it's clickable). This allows you to open the "attachment task" from the main task.

To use this code you need to:

  1. Set macro security to low during testing. You can sign it using selfcert later.
  2. Open VBA Editor using Alt+F11
  3. Right click on Project1 and choose Insert > Module.
  4. Paste the code below into the module.
  5. Edit the folder path for the local folder
  6. If you don't want the message body in addition to the attachment, delete that line from the first objTask code block.
  7. Uncomment the .display line if you want the task opened to add notes.
  8. Get the GetFolderPath function and paste it in the module after this macro.
  9. Select a message, run the macro. Note: if you select more than one message, it creates a task for each message.

 Sub ConvertMessagetoTwoTasks()
    Dim objTask As Outlook.TaskItem
    Dim objMail As Outlook.MailItem
    Dim newAttachment As Outlook.Attachment
    Dim strID As String
    ' Non-default folder
' Get function fromhttp://slipstick.me/qf#GetFolderPath
    Set SPSFolder = GetFolderPath("acct-name\Tasks")
 
For Each objMail In Application.ActiveExplorer.Selection
  Set objTask = Application.CreateItem(olTaskItem)
 
' Create task with message attached
' for local folder
Set newAttachment = objTask.Attachments.Add(objMail, Outlook.OlAttachmentType.olEmbeddeditem)

With objTask
    .subject = objMail.subject
    .DueDate = objMail.ReceivedTime + 3
    .StartDate = objMail.ReceivedTime + 2
    '.Body = objMail.Body
    .Categories = "MOVED"
    .Save
End With
Set MovedTask = objTask.Move(SPSFolder)
    strID = MovedTask.EntryID

Set objTask = Application.CreateItem(olTaskItem)
' create task for default folder
With objTask
    .subject = objMail.subject & " outlook:" & strID
    .DueDate = objMail.ReceivedTime + 3
    .StartDate = objMail.ReceivedTime + 2
    .Body = objMail.Body
    .Categories = "Working"
    .Save
    .Display
End With
      
    Next
    Set objTask = Nothing
    Set objMail = Nothing
End Sub

 

Set Reminders

To override your default settings for Task reminders (set in Options, Tasks), you can use the ReminderSet and ReminderTime properties.

This example creates a reminder for 6 hrs before the due date or 6 pm the day before. If a reminder time is not set, it will use the default setting for Tasks, usually 8 am on the due date.

Accepted values for ReminderSet are True (on) or False (no reminder)

objTask.ReminderSet = True
objTask.ReminderTime = objTask.DueDate - 0.25

 

Insert a hyperlink to the message

This code won't work with iCloud tasks because the link is removed from the body. If you are using it with a local task folder that does support hyperlinks, add the Dim's to the top of the code and the other lines after the End With in the first sample above.

Dim objInsp As Inspector
Dim objDoc As Word.Document
Dim objSel As Word.Selection

 Set objInsp = objTask.GetInspector
 Set objDoc = objInsp.WordEditor
 Set objSel = objDoc.Windows(1).Selection
 objDoc.Hyperlinks.Add objSel.Range, strLink, "", "", strLinkText, ""
objTask.Save

More Information

The original email-to-task code is at Create a Task from an Email using a Rule.
How to use the VBA Editor

Create a Task and copy to another Tasks folder was last modified: January 4th, 2018 by Diane Poremsky

Related Posts:

  • Create a Series of Tasks Leading up to an Appointment
  • Create Task or Appointment and Insert Selected Text
  • Create a Task from an Email using a Rule
  • Create a Series of Tasks using VBA

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
2 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

John Riehl
December 6, 2015 5:32 pm

Diane,

This was fantastic...thanks. I modified it to create a new task in my PST based on a currently selected task. My particular workflow involves attaching multiple objects to a task when they're related...could be e-mails, documents, or whatever. When I have a task that I want to put an attachment into, I use this macro to automatically create the linked task.

Sub CreateLinkedAttachmentTask()
Dim objTask As Outlook.TaskItem
Dim linkTask As Outlook.TaskItem
Dim strID As String
' Non-default folder
Set SPSFolder = GetFolderPath("myPSTTasks")

For Each objTask In Application.ActiveExplorer.Selection
Set linkTask = Application.CreateItem(olTaskItem)

' create the task that will hold attachments
With linkTask
.Subject = objTask.Subject
.Body = objTask.Body
.Save
End With

' move it to the local pst and get a link to it
Set movedTask = linkTask.Move(SPSFolder)
strID = movedTask.EntryID
movedTask.Display

' update the subject of the current task with the link
With objTask
.Subject = objTask.Subject & " outlook:" & strID
.Body = "See linked task"
.Save
End With
Next

Set objTask = Nothing
Set linkTask = Nothing
End Sub

0
0
Reply
mary tanzy
June 6, 2014 10:24 am

For OneNote users, another method is to create a link to a OneNote file; the OneNote file will show the hidden attachments that you have dragged to the Task but cannot see displayed, or you can drag the attachments into the OneNote file itself. To create the link: 1. Open OneNote
2. Create a new page in the desired section (I have a Getting Things Done section for uncategorized projects and other sections for categorized projects--Vendors, Personnel), using the OneNote button in the Task tab
3. When the popup window appears prompting you to select a page to link to, select the page you have just created.

2
-2
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 28

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
  • Classic Outlook is NOT Going Away in 2026
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Classic Outlook is NOT Going Away in 2026

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

:wpds_smile::wpds_grin::wpds_wink::wpds_mrgreen::wpds_neutral::wpds_twisted::wpds_arrow::wpds_shock::wpds_unamused::wpds_cool::wpds_evil::wpds_oops::wpds_razz::wpds_roll::wpds_cry::wpds_eek::wpds_lol::wpds_mad::wpds_sad::wpds_exclamation::wpds_question::wpds_idea::wpds_hmm::wpds_beg::wpds_whew::wpds_chuckle::wpds_silly::wpds_envy::wpds_shutmouth:
wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment