Create an Outlook appointment from an email message

Status
Not open for further replies.

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

Patrick Corun

New Member
Outlook version
Outlook 2013 32 bit
Email Account
IMAP

Hello Diane, I am trying to work through a few issues with outlook 2013. My employer does not use an exchange server for emails and this makes it difficult to use some of the canned features within outlook. for example I can't create an appointment from an email, since my data file is for another account set up under outlook.com. So I tried the VBA code you recommended in this article and it works fine. Howver, I would like to know how I can have the appointment detail windo open up so that I can edit, modify or change things to the appointment. What would need to be added to the VBA code to make this happen and where would I need to add the code? I am not very good at VBA programming and would need some direction. Thanks in advance!! Here is the code.


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

Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
Dim oFolder As Outlook.Folder
Dim FoldersArray As Variant
Dim i As Integer

On Error GoTo GetFolderPath_Error
If Left(FolderPath, 2) = "\\" Then
FolderPath = Right(FolderPath, Len(FolderPath) - 2)
End If
'Convert folderpath to array
FoldersArray = Split(FolderPath, "\")
Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
If Not oFolder Is Nothing Then
For i = 1 To UBound(FoldersArray, 1)
Dim SubFolders As Outlook.Folders
Set SubFolders = oFolder.Folders
Set oFolder = SubFolders.Item(FoldersArray(i))
If oFolder Is Nothing Then
Set GetFolderPath = Nothing
End If
Next
End If
'Return the oFolder
Set GetFolderPath = oFolder
Exit Function

GetFolderPath_Error:
Set GetFolderPath = Nothing
Exit Function
End Function
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 
P

pcorun

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.


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


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

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Here is the structure I used, but it was not successful:
.Save
.Move CalFolder
.Display


Do I need to set something after the .Display??
No, and you don't need display if you are just moving and don't want to make any changes to it.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Create appointment to custom (shared) outlook calendar Outlook VBA and Custom Forms 3
C Can't create Outlook data file Outlook Wishlist 0
G Can't create Folder Groups in Outlook 2013 Using Outlook 0
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
F Delete/create/reset Exchange mailbox on Outlook.com Using Outlook.com accounts in Outlook 3
R Can not create folder to store specific emails in in Outlook for Mac Using Outlook 1
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
Rupert Dragwater How to create a new email with @outlook.com Using Outlook.com accounts in Outlook 32
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
R Outlook add-in to create new contact from an email. Using Outlook 0
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
D Outlook macros to create meeting on shared calendar Outlook VBA and Custom Forms 10
G How do I create a custom pick list in VB for an outlook automated email? Outlook VBA and Custom Forms 1
Diane Poremsky Create a custom field for Outlook messages New Slipstick.com Articles 0
Diane Poremsky Create a Custom Numbering Field for Outlook messages New Slipstick.com Articles 0
Diane Poremsky Manually create a POP3 account in Outlook 2007 New Slipstick.com Articles 0
T Create Rule For Secondary E-Mail Address In Outlook 2016 Using Outlook 4
Diane Poremsky Use VBA to create an Outlook Search Folder for Sender New Slipstick.com Articles 0
Diane Poremsky Outlook Crashes When You Reply or Create a New Message New Slipstick.com Articles 0
I Create custom Outlook 2013 Rule in Office 365 Outlook VBA and Custom Forms 5
C Edit/Create Pen Not Working Outlook 2013 Using Outlook 1
Rupert Dragwater Outlook could not create the work file Using Outlook 5
J Outlook Rule - Create Link in Forwarding Message Outlook VBA and Custom Forms 2
E Create a URL hyperlink in an Outlook custom form? Outlook VBA and Custom Forms 2
R iCloud Issues in Outlook 2013, cannot create reminders Using Outlook 2
Rupert Dragwater How to delete old rules and create new in Outlook 2013 Using Outlook 12
P Cannot open Options Menu Outlook 2007 and Cannot create a new profile Using Outlook 0
C Outlook 2007 cant create new account Using Outlook 7
G Outlook could not create the work file Using Outlook 0
K Outlook Cached Mode - can't create rules to move email to another mailbox Using Outlook 2
O Can't create new email or access email acounts Outlook 2003 Using Outlook 1
S [outlook-users] Create contact group from other user's contacts Using Outlook 1
J Create new outlook task into task subfolder using vba Using Outlook 6
L Create hyperlinks to bookmarks in Outlook 2003 otf file Using Outlook 1
B How do I create and send mail in Outlook 2003 from code? Using Outlook 5
O Outlook 2010 - How to create custom Group By Arrangements for email Using Outlook 3
R Outlook 2007 attachments create multiple copies in the inbox Using Outlook 3
B How to create fixed reminders in Outlook Using Outlook 2
V Outlook - Unable to Create New Email Account Automatically Using Outlook 2
T Outlook 2010 continues to deselect self while trying to create email Using Outlook 3
A Outlook 2010 trying to create calendar/task entries generates error "Could not save item.The connect Using Outlook 2
A Outlook 2010 trying to create calendar/task entries generates error "Could not save item.The connect Using Outlook 1
P Cannot create connected drop down list in Outlook 2007 forms Using Outlook 1
M Can't create quickparts in Outlook 2010 Using Outlook 1
C Outlook VBA - Create Macro Move Contact field Item to Another Using Outlook 1
R How to use Outlook 2007 Calendar to create a meeting or apointment with a specific color code / background? Using Outlook 1
F Create a second Outlook profile to handle a second email account. Using Outlook 2
M Create Mailing Labels using Contacts in Outlook 2010 Using Outlook 2
R Outlook Calendar - Directly typing in to quick-create reservations often get cut off. Buggy. Using Outlook 1
J Is it possible to create text columns in Outlook? Can images be placed out of line with the text? Using Outlook 1

Similar threads

Top