Body text of Email from invite date/time

Status
Not open for further replies.

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
 
Alright, I’ve never made a custom macro before. How would I get it to read those fields?
 
I will see if i have something close to it or will put something together. (It might make a nice article. :))
 
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
 
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
 
It looks good - i did not test it, but nothing bad jumps out at me in reading through it.
 
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.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
Z Copy specific email body text Outlook VBA and Custom Forms 0
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
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
P Forwarding emails issue with special characters replacing text body 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
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
G Retaining Tabs in outlook body Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
G Get current open draft message body from VBA Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
C Populate form data into message body Outlook VBA and Custom Forms 1
J Outlook 365 Add keywords from Listbox to the message body where cursor is placed Outlook VBA and Custom Forms 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
Beeto Replace a string in body Outlook VBA and Custom Forms 2
J How do you disable address search box when typing @ in body of email? Using Outlook 0
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
J Implement Keywords based on body message Outlook VBA and Custom Forms 0
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
Witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
Z Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1

Similar threads

Back
Top