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

Create an Outlook Appointment from a Message

Slipstick Systems

› Developer › Code Samples › Create an Outlook Appointment from a Message

Last reviewed on August 29, 2018     98 Comments

Applies to: Outlook (classic), Outlook 2010

A security update disabled the Run a script option in the rules wizard in Outlook 2010 and all newer Outlook versions. See Run-a-Script Rules Missing in Outlook for more information and the registry key to fix restore it.

The code samples on this page create an appointment from an email message and adds it to a calendar. It's based off of the Convert email to task macro, but we needed the email added to a shared calendar to create a diary of sorts rather than as a Task.

Outlook 2013 and Outlook 2016's Quick Steps can be used to create an appointment but Quick Steps use the default reminder setting (and the default calendar).

This first macro works with open or selected Outlook items and creates a new appointment in a subfolder calendar named Log. The Outlook item is added as an attachment.

To use this macro, paste the code into a module and add a button to the ribbon or Quick Access Toolbar (QAT) in Outlook. The macro will work with either an open or selected item and you'll want to add a button to each item type you want to use it with.

To create an appointment from appointment details in the subject or message body, see "Create Appointment From Email Automatically".

Private Sub CreateLogCalendar()
       
Dim Ns As Outlook.NameSpace
Dim objApp As Outlook.Application
Dim olAppt As Outlook.AppointmentItem
Dim Item As Object ' works with any outlook item
 
Set Ns = Application.GetNamespace("MAPI")
Set objApp = Application

'On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
 Case "Explorer"
    Set Item = objApp.ActiveExplorer.selection.Item(1)
 Case "Inspector"
    Set Item = objApp.ActiveInspector.CurrentItem
End Select

  ' Subfolder named 'Log' under calendar
Set calFolder = Ns.GetDefaultFolder(olFolderCalendar).Folders("Log")
Set olAppt = calFolder.Items.Add(olAppointmentItem)
With olAppt
        .Subject = Item.Subject
        .Attachments.Add Item
        '.Body = Item.Body
        .Start = Now
        '.End = Now 
        .ReminderSet = False
        .BusyStatus = olFree
        .Save
        .Display 'show to add notes
End With
Set objApp = Nothing
Set Ns = Nothing
End Sub

 

Save Message as Appointment

This code sample creates a new appointment on your default calendar and pastes the body of the selected message into the appointment's note's field.

It uses the Word object model; you'll need to set a reference to the Word Object Model in Tools, References.

Sub ConvertMessageToAppointment()
    Dim objAppt As Outlook.AppointmentItem
    Dim objMail As Outlook.MailItem
    Dim objInsp As Inspector
    Dim objDoc As Word.Document
    Dim objSel As Word.Selection

Set objMail = Application.ActiveExplorer.Selection.Item(1)

  If Not objMail Is Nothing Then
        If objMail.Class = olMail Then
            Set objInsp = objMail.GetInspector
            If objInsp.EditorType = olEditorWord Then
                Set objDoc = objInsp.WordEditor
                Set objWord = objDoc.Application
                Set objSel = objWord.Selection
        With objSel
            .WholeStory
            .Copy
       End With
 
            End If
        End If
    End If

    Set objAppt = Application.CreateItem(olAppointmentItem)
    Set objInsp = objAppt.GetInspector
    Set objDoc = objInsp.WordEditor
    Set objSel = objDoc.Windows(1).Selection

With objAppt
    .Subject = objMail.Subject
    .Categories = "From Email"
   
    objSel.PasteAndFormat (wdFormatOriginalFormatting)
    '.Attachments.Add objMail
    '.Save
    .Display
End With
    
    objMail.Categories = "Appt" & objMail.Categories
    Set objAppt = Nothing
    Set objMail = Nothing
End Sub

 

Create the appointment using rules

This macro uses a rule to create an appointment from incoming email. The rule should only contain conditions, not Actions. All actions need to be handled by the script. For more information, see Outlook's Rules and Alerts: Run a Script.

Because of limitations in appointments, any html in the message body won't be formatted.

The method used in other macros on this page to copy and paste formatted text wont work here, unless you have the macro open and close the incoming message. If you don't mind the quick flash onscreen as the macro opens and close the messages, I have a macro here that copies and pastes formatted text.

Public Sub ApptFromMail(Item As MailItem)

Dim objAppt As Outlook.AppointmentItem
Set objAppt = Application.CreateItem(olAppointmentItem)

With objAppt
    .Subject = Item.Subject
    .location = "Location"
    .AllDayEvent = True
    .BusyStatus = olBusy
    .Start = Date + 3
    .Body = Item.Body
    .Display
    .Save

End With
    Set objAppt = Nothing
End Sub

Save the Appointment to a Shared Calendar

This version of the macro moves the resulting appointment to a Calendar in a shared mailbox or different data file.

To use this macro, you also need the GetFolderPath function from this page.

Select a message then run the macro to create an appointment in the designated calendar.

February 8 2015 updated code to work with a single selected message, not all messages in a selection.


Sub ConvertMailtoAccountAppt()
    Dim objAppt As Outlook.AppointmentItem
    Dim objMail As Outlook.MailItem
    
    Set objAppt = Application.CreateItem(olAppointmentItem)
    Set CalFolder = GetFolderPath("mailbox-name\Calendar")
  
   Set objMail = Application.ActiveExplorer.Selection.Item(1)
With objAppt
    .Subject = objMail.Subject

'sets it for tomorrow at 9 AM
    .Start = DateSerial(Year(Now), Month(Now), Day(Now) + 1) + #9:00:00 AM#
    .Body = objMail.Body

    .Save
    .Move CalFolder
End With    

    Set objAppt = Nothing
    Set objMail = Nothing
End Sub

To create the appointment using the message's received time, use

objAppt.Start = objMail.ReceivedTime

Create a meeting with the recipients

This version of the code creates a new meeting with the sender and recipients of the message, with the CC'd recipients listed as optional attendees.

Yes, Outlook includes a command to create a meeting with the recipients of the current message, but everyone is placed in the Required field.

Sub ConvertMailtoMeeting()
    Dim objAppt As Outlook.AppointmentItem
    Dim objMail As Outlook.MailItem
    Dim objRecip As Outlook.Recipients
    Dim myAttendee As Outlook.Recipient
 
  Dim strAddress As String
  Dim x As Long
  Dim myCounter As Integer
  
 'On Error Resume Next
  
    Set objAppt = Application.CreateItem(olAppointmentItem)
    objAppt.MeetingStatus = olMeeting
    ' Set CalFolder = GetFolderPath("alias@domain.com\Calendar")
   
Set objMail = Application.ActiveExplorer.Selection.Item(1)

Set objRecip = objMail.Recipients
        Debug.Print objRecip.Count
         myCounter = objRecip.Count
         
strAddress = objMail.SenderEmailAddress
Set myAttendee = objAppt.Recipients.Add(strAddress)
myAttendee.Type = olRequired
            
For x = 1 To myCounter
 strAddress = objMail.Recipients(x).Address
    Set myAttendee = objAppt.Recipients.Add(strAddress)

   Select Case objMail.Recipients(x).Type
     Case 1
            myAttendee.Type = olRequired
     Case 2
            myAttendee.Type = olOptional
   End Select
Next x
    objAppt.Subject = objMail.Subject

'sets it for tomorrow at 9 AM
    objAppt.Start = DateSerial(Year(Now), Month(Now), Day(Now) + 1) + #9:00:00 AM#
    objAppt.Body = objMail.Body

   ' objAppt.Save
    'objAppt.Move CalFolder

objAppt.Display

    Set objAppt = Nothing
    Set objMail = Nothing
End Sub

Create an appointment for messages you send

This macro watches the Sent Items Folder for new items and creates an appointment in a subfolder of the default calendar.

Use an If statement as the first line of the olSent_ItemAdd macro to filter messages, such as create an appointment only if assigned to the category "Appt". (Note that unless you use Exchange server, categories are sent with messages.)

If Item.Categories <> "Appt" Then Exit Sub

Copy and paste the following code into ThisOutlookSession then restart Outlook.

You can use this code to watch the Inbox (change the Set olSent line to use olFolderInbox) and use an If statement to look for specific items. The incoming messages need to contain the appointment data in an uniform format. A code sample using a specially-crafted subject line and one using regex are available at

Dim WithEvents olSent As Items
Dim WithEvents calFolder As Outlook.Folder
Private Sub Application_Startup()
   Dim NS As Outlook.NameSpace
   Set NS = Application.GetNamespace("MAPI")
   Set olSent = NS.GetDefaultFolder(olFolderSentMail).Items
   Set calFolder = NS.GetDefaultFolder(olFolderCalendar).Folders("Test")
 Set NS = Nothing
End Sub
   
Private Sub olSent_ItemAdd(ByVal Item As Object)
Dim objAppt As Outlook.AppointmentItem
Set objAppt = calFolder.Items.Add(olAppointmentItem)

With objAppt
    .Subject = Item.Subject
    .Start = Now
    .Body = Item.Body
    .Save
End With
 
    Set objAppt = Nothing
                 
 End Sub

How to use macros

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To put the code in a module:

  1. Right click on Project1 and choose Insert > Module
  2. Copy and paste the macro into the new module.

More information as well as screenshots are at How to use the VBA Editor

More Information

Other macros to create tasks or appointments are at

  • Automatically create a task when sending a message
  • Create a Task from an Email using a Rule
  • Create an Outlook Appointment from a Message
  • Create Task or Appointment and Insert Selected Text
  • Create Tasks from Email and move to different Task folders
  • Replicate GTD: Create a task after sending a message
Create an Outlook Appointment from a Message was last modified: August 29th, 2018 by Diane Poremsky

Related Posts:

  • Create Appointment From Email Automatically
  • Create a Series of Tasks Leading up to an Appointment
  • Create Task or Appointment and Insert Selected Text
  • Move Appointments to an Archive Calendar

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
98 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

Indy
May 7, 2021 2:54 am

Hi,
you really helped me. Thank you!
I'm using the second makro and Outlook 2019 and there is a little problem with the line

     objSel.PasteAndFormat (wdFormatOriginalFormatting)
I'm getting a runtime error 4605. Du you know any tweak?

0
0
Reply
Diane Poremsky
Author
Reply to  Indy
May 7, 2021 8:50 am

I'll check it - I've had that error off and on - it usually works if I run I again. I'll test it again.

0
0
Reply
Tim
February 3, 2021 1:28 pm

Diane thank you for sharing, this is great. I am trying to use the "Save Message as Appointment" code but would like to add some functionality and can't seem to get it working.
1) take any attachments from the original email and add them to the calendar event. 2) define which calendar the event is added to

0
0
Reply
Diane Poremsky
Author
Reply to  Tim
May 7, 2021 8:58 am

For attachments, you need to save the attachment and add to the appt. You need to use the CopyAttachments function and ad this line to your code.
CopyAttachments item, objAppt

This is the function -
Sub CopyAttachments(objSourceItem, objTargetItem)
'Cannot get this part to work (to copy attachments)
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set fldTemp = fso.GetSpecialFolder(2) ' TemporaryFolder
  strPath = fldTemp.Path &amp; "\"
  For Each objAtt In objSourceItem.Attachments
   strFile = strPath &amp; objAtt.FileName
   objAtt.SaveAsFile strFile
   objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
   fso.DeleteFile strFile
  Next
 
  Set fldTemp = Nothing
  Set fso = Nothing
End Sub

This sample shows how to set different folders - Create Tasks from Email and move to different Task folders (slipstick.com) It's easy to change it from task to appointments.

0
0
Reply
Hans
November 12, 2019 8:58 am

HI,
I was looking for this for some time, it helped me really :-)
There one strange thing, when I open the appointment after saving it, the html email body shows fine, but on closing I get the question if I want to save the changes. I did not change anything so when I click no and reopen the appointment, the body content is gone. when I click yes to save the (not made) changes, all is there after reopening.
Can I do something to prevent the save changes question?
Thanks in advance,
Hans

0
0
Reply
Diane Poremsky
Author
Reply to  Hans
November 12, 2019 12:10 pm

are there links to external images or other content in the body? That can trigger it.

0
0
Reply
Hans
Reply to  Diane Poremsky
November 12, 2019 12:20 pm

Yes, it is an email comming from my site. It is made with a template containing the company logo.
Can anything be done to prevent it?

0
0
Reply
JJDD
October 18, 2019 4:35 am

I really wanna make a script that when an email comes in with my seat number It will be added as an appointment on my calendar. So email comes through with seat D4 i want that to be put on my calendar ?

0
0
Reply
Diane Poremsky
Author
Reply to  JJDD
November 12, 2019 10:49 am

the 'Create the appointment using rules' macro should work - look for the seat # using the rule. It's also possible to use regex to find it, but rules would be better unless it finds a lot of false positives.

0
0
Reply
Dave
April 18, 2019 1:09 pm

How do I make an attachment to a calendar event before I
.save and .send

0
0
Reply
Diane Poremsky
Author
Reply to  Dave
November 12, 2019 9:36 am

You need to use .attachments.add:
item.Attachments.Add "C:\Users\username\Documents\TEST.xlsx"

0
0
Reply
Dolf
July 25, 2018 6:00 am

Hi
Is there a way to retrieve the start and end date from a mail's body that is always in a specific format?
objTask.StartDate = Item.ReceivedTime + 2
objTask.DueDate = Item.ReceivedTime + 3
objTask.Categories = "Slipstick"

0
0
Reply
Diane Poremsky
Author
Reply to  Dolf
July 25, 2018 11:21 pm

Yes, you can either use instr & related functions or regex. The second macro at https://www.slipstick.com/developer/code-samples/create-appointment-email-automatically/ shows how.

0
0
Reply
Diane Poremsky
Author
March 10, 2017 4:08 pm

pcorun said

Here is the structure I used, but it was not successful:
.Save
.Move CalFolder
.Display

Do I need to set something after the .Display??

Click to expand...

No, and you don't need display if you are just moving and don't want to make any changes to it.

0
0
Reply
pcorun
July 18, 2016 5:01 pm

Diane Poremsky said

Sorry I missed this earlier. You'd normally add .Display after this line

.Body = objMail.Body

but since you are moving it, add .display after the move.

Click to expand...

Here is the structure I used, but it was not successful:
.Save
.Move CalFolder
.Display

Do I need to set something after the .Display??

0
0
Reply

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

Latest EMO: Vol. 30 Issue 34

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
  • Use Classic Outlook, not New Outlook
  • Mail Templates in Outlook for Windows (and Web)
  • How to Remove the Primary Account from Outlook
  • Reset the New Outlook Profile
  • Disable "Always ask before opening" Dialog
  • Adjusting Outlook's Zoom Setting in Email
  • This operation has been cancelled due to restrictions
  • How to Hide or Delete Outlook's Default Folders
  • Change Outlook's Programmatic Access Options
  • Shared Mailboxes and the Default 'Send From' Account
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • 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
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

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

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

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