Create an Outlook appointment from an email message

Status
Not open for further replies.

Diane Poremsky

Senior Member
OS Version(s)
  1. MacOS
  2. Windows
  3. iOS
  4. Android
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

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
 
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??
 
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
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
J PSA: How to create custom keyboard shortcut for "Paste Unformatted Text" in Outlook on Windows Outlook VBA and Custom Forms 1
Commodore Any way to create "from-only" account on Outlook 2021? Using Outlook 1
N Can't create NEW GROUP and add/remove a member from existing Group in Outlook Using Outlook 1
O Outlook 365 - How to create / copy a new contact from an existing one? Using Outlook 5
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 Using Outlook 0
Diane Poremsky Create a Custom Numbering Field for Outlook messages Using Outlook 0
Diane Poremsky Manually create a POP3 account in Outlook 2007 Using Outlook 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 Using Outlook 0
Diane Poremsky Outlook Crashes When You Reply or Create a New Message Using Outlook 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
J Create or Import a Outlook Rule through C# code. Outlook VBA and Custom Forms 2
F can I use Outlook 2007 to create peer review/approve/reject forms Outlook VBA and Custom Forms 1
E Outlook could not create the work file. Check the temp environment variable Using Outlook 8
S Create a new Outlook MailItem in an Outlook folder(not a draft) Outlook VBA and Custom Forms 2
D Create a macro in Outlook to run a rule Outlook VBA and Custom Forms 32
B How to create the customized Outlook SQL DASL for selected days? Outlook VBA and Custom Forms 2
N How Can I create an Outlook Macro to import calendar? Outlook VBA and Custom Forms 1
S HELP: Create Buttons in Outlook Email body or Tool bar Outlook VBA and Custom Forms 1
N How to create hidden rule in outlook 2007 Outlook VBA and Custom Forms 3

Similar threads

Back
Top