Body text of Email from invite date/time

Someguy

New Member
Outlook version
Outlook 2019 64-bit
Email Account
Office 365 Exchange
Hello,

I send numerous meeting invites to clients everyday, and they are all a generic statement, but they each have the date and time of the meeting in the body of the email text. I wanted to know if there is a way for when I send a calendar invite from outlook to have it auto fill the body of the email and pull the date and time into the body of the email from the invite date/time drop down menu. I image this will require a macro or something, but given the frequency I need to do this everyday, saving repetitive data entry will be a huge help.

thank you,
james
 

Someguy

New Member
Outlook version
Outlook 2019 64-bit
Email Account
Office 365 Exchange
Alright, I’ve never made a custom macro before. How would I get it to read those fields?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I will see if i have something close to it or will put something together. (It might make a nice article. :))
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This is the basics - fill out the appointment fields then run the macro. This only does the date, but you can add any of the appointment fields.
Code:
Sub CopyMeetingInfo()
    Dim objApp As Outlook.Application
    Dim objAppt As Outlook.AppointmentItem
    
    Set objApp = Application
    Set objAppt = objApp.ActiveInspector.CurrentItem

  If Not objAppt Is Nothing Then
        If objAppt.Class = olAppointment Then
           objAppt.Body = "Start date and time: " & objAppt.Start & vbCrLf & "End date and time: " & objAppt.End & crlf & objAppt.Body
           
            
        End If
    End If
    
    Set objAppt = Nothing
End Sub
 

Someguy

New Member
Outlook version
Outlook 2019 64-bit
Email Account
Office 365 Exchange
Okay, so that got me started, but I ended up going a different route after a few hours of work. I ended up making a UserForm that I call from a button on the ribbon, which makes the invite and then displays it. I'm sure there are more elegant ways of doing what I did, but I am rather happy with how it turned out. I have a Userform that has fields to enter the case number, client name, and client email, drop downs for time and time zone and date picker. Here is my code, I'd love some feed back on it.


Option Explicit
'Private oVars As Variables


Private Sub Cancel_Click()
Unload Me
End Sub

Private Sub Clear_Click()

UserForm1.CaseNum = ""
UserForm1.ClientName = ""
UserForm1.ClientEmail = ""

End Sub

Private Sub Generate_Click()
Dim OutApp As Object
Dim OutMail As Object
'Dim dTheDate As Date
Dim tzstart As Outlook.TimeZone
Dim tzabv As String



'dTheDate = DateAdd("d", 28, Me.TextBox5.Value)

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(1)
Select Case UserForm1.TimeZone
Case "Eastern Standard Time"
Set tzstart = Application.TimeZones.Item("Eastern Standard Time")
tzabv = "EST"
Case "Central Standard Time"
Set tzstart = Application.TimeZones.Item("Central Standard Time")
tzabv = "CST"
Case "Mountain Standard Time"
Set tzstart = Application.TimeZones.Item("Mountain Standard Time")
tzabv = "MST"
Case "Pacific Standard Time"
Set tzstart = Application.TimeZones.Item("Pacific Standard Time")
tzabv = "PST"
Case "Alaska Standard Time"
Set tzstart = Application.TimeZones.Item("Alaska Standard Time")
tzabv = "AKST"
Case "Hawaii Standard Time"
Set tzstart = Application.TimeZones.Item("Hawaii Standard Time")
tzabv = "HST"
End Select

'With OutMail
OutMail.MeetingStatus = olMeeting
OutMail.RequiredAttendees = UserForm1.ClientEmail.Value
OutMail.Subject = "Company Webex - Case #" + UserForm1.CaseNum.Value
OutMail.Body = "Hello " & UserForm1.ClientName & "," & vbCrLf & vbCrLf & "I have scheduled your Company WebEx Session for " & UserForm1.MtgDate & " at " & UserForm1.Time & " " & tzabv & "." & vbCrLf & vbCrLf & "Please utilize the below link to access" & vbCrLf & vbCrLf & "WebEx: link-redacted" & vbCrLf & vbCrLf & "Your session number will be provided at the time of the meeting." & vbCrLf & vbCrLf & "Thank you," & vbCrLf & "James"
OutMail.Start = UserForm1.Time & UserForm1.MtgDate
OutMail.Duration = 60
OutMail.ReminderSet = True
OutMail.ReminderMinutesBeforeStart = 15
OutMail.Location = "Company Webex"
OutMail.StartTimeZone = tzstart
'End With

Unload Me
OutMail.Display
'.Close SaveChanges:=False
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


Private Sub UserForm_Initialize()





Caption = "Company Webex Invitation"
Label2.Caption = "Case Number"
Label3.Caption = "Client Name"
Label4.Caption = "Meeting Date"
Label5.Caption = "Time"
Label6.Caption = "Time Zone"
Generate.Caption = "Generate Invite"


'Fill Date Drop Down box
With Time
.AddItem "8:00 AM"
.AddItem "8:30 AM"
.AddItem "9:00 AM"
.AddItem "9:30 AM"
.AddItem "10:00 AM"
.AddItem "10:30 AM"
.AddItem "11:00 AM"
.AddItem "11:30 AM"
.AddItem "12:00 PM"
.AddItem "12:30 PM"
.AddItem "1:00 PM"
.AddItem "1:30 PM"
.AddItem "2:00 PM"
.AddItem "2:30 PM"
.AddItem "3:00 PM"
.AddItem "3:30 PM"
.AddItem "4:00 PM"
.AddItem "4:30 PM"
.AddItem "5:00 PM"
.AddItem "5:30 PM"
.AddItem "6:00 PM"
.AddItem "6:30 PM"
.AddItem "7:00 PM"
.AddItem "7:30 PM"
.AddItem "8:00 PM"
.AddItem "8:30 PM"
.AddItem "9:00 PM"
End With

With TimeZone
.AddItem "Eastern Standard Time"
.AddItem "Central Standard Time"
.AddItem "Mountain Standard Time"
.AddItem "Pacific Standard Time"
.AddItem "Alaska Standard Time"
.AddItem "Hawaii Standard Time"
End With




End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It looks good - i did not test it, but nothing bad jumps out at me in reading through it.
 

Someguy

New Member
Outlook version
Outlook 2019 64-bit
Email Account
Office 365 Exchange
Well that’s relieving to hear. I know I need to delete a few commented out lines, and clean up a bit, but i’m glad I didn’t make any major mistakes. When I tested it, it works exactly like I wanted it to.
 
Similar threads
Thread starter Title Forum Replies Date
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
C Transfer Outlook TextBox Text Into Email Body Outlook VBA and Custom Forms 2
divan Outlook 2007 - Replace email body with custom text Using Outlook 9
E Button in body of email to approve/reject with original text Using Outlook 1
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
K Update subject based on text in body Outlook VBA and Custom Forms 3
L auto copy text in mail body to other part of the body Outlook VBA and Custom Forms 1
M Extract text in existing message body for use in newmail items Using Outlook 17
R How to format text within appointment/meeting body? Using Outlook 6
I Outlook Appointments - Setting default text in message body Using Outlook 3
J Form 'While You Were Out' body text not working Using Outlook 24
P HTA creating Outlook MeetingItem - need formatted body text Using Outlook 4
O pasting text in body of calendar events Using Outlook 5
L No body text in Outlook 2010 messages Using Outlook 0
B Received Plain Text Message - Body Grayed Out Using Outlook 1
F I cannot highlight text in Microsoft Outlook 2010 e-mails, and copy/paste to the body of another e-m Using Outlook 3
R Outlook 2010: Text in Body Being Change, HTML tags/code showing Using Outlook 3
C Outlook 2007 No text in Message body Using Outlook 1
N Emails sent from Outlook 2010 are being received with some corruption of the body text Using Outlook 37
S write and format a piece of text in the body using vba Outlook VBA and Custom Forms 7
M How to input text at the beginning of the body of a message. Outlook VBA and Custom Forms 1
M Append text to (formatted) body of Reply Outlook VBA and Custom Forms 2
P How to get Selected Body message Text Outlook VBA and Custom Forms 7
T How can i save the body as text file Outlook VBA and Custom Forms 1
B Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
A How To Get Body of All Emails to view in Blue Using Outlook 1
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Programmatically force html send and insert clipboard contents into body Outlook VBA and Custom Forms 0
L dynamic and static dates in Outlook contact "notes" ie. body Using Outlook 2
L Wierd Office 365 Contact unable to edit body of random contacts Using Outlook 5
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
W Space in an Outlook appointment body Using Outlook 0
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
B Automatically Forward Emails and Remove/Replace All or Part of Body Outlook VBA and Custom Forms 8
E Copying the whole e-mail body into excel Outlook VBA and Custom Forms 0
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
C How to replace or delete first instance of sentence in mail body? Outlook VBA and Custom Forms 1
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
Y VBA Macro to highlight some Keyword in mail body? Outlook VBA and Custom Forms 3
A Forwarding email and replacing body Outlook VBA and Custom Forms 1
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
K How to find specific header and copy the mail body Using Outlook 0
D Outlook macro with today's date in subject and paste clipboard in body Outlook VBA and Custom Forms 1
M Want to autorespond to an email address in the body of message Using Outlook 0

Similar threads

Top