Using Data From Combo Box in Appointment Body

Not open for further replies.

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
I am attempting to take a different spin on the tutorial below:

Select from a List of Subjects before Sending a Message
Select from a List of Subjects before Sending a Message

I am attempting to utilize this form and macro for adding data to the body of an appointment item. Currently my macro utilizes input boxes to include several different data entries into the appt.body

I would love to add data to the appt.body using both input boxes and combo boxes. However if I add the form, code, and macro code. The input box data overrides the combobox data.If I rem the appt.body inputbox data the combobx adds the data to the body. It seems either one or the other will populate the body not both.

Any way of utilizing bot input boxes and combo boxes to the appt.body? Or any way for the userform to include both text box and combo box data to the appt.body?

Sub CreateMeetingatContactLocation()
Dim oOL As Outlook.Application
Dim NS As Outlook.NameSpace
Dim objOwner As Outlook.Recipient
Dim objAppt As Outlook.AppointmentItem
Dim objAppointment As Outlook.AppointmentItem
Dim objContact As Outlook.ContactItem
Dim strPhone As String
Set NS = Application.GetNamespace("MAPI")
  Set objOwner = NS.CreateRecipient("")
If objOwner.Resolved Then
    'MsgBox objOwner.Name
Set newCalFolder = NS.GetSharedDefaultFolder(objOwner, olFolderCalendar)
End If
Set oOL = Outlook.Application
Set objAppt = newCalFolder.Items.Add("IPM.Appointment.Beaton Service Form 4.3")
Set objContact = oOL.ActiveExplorer.Selection.Item(1)

' oMail.Display

  '  MsgBox "user chose " & lstNo & " from combo"

    Select Case lstNo
    Case -1
         objAppt.Body = objAppt.Body
    Case 0
         objAppt.Body = "Subject 1"
    Case 1
         objAppt.Body = "Subject 2"
    Case 2
         objAppt.Body = "Subject 3"
    Case 3
         objAppt.Body = "Subject 4"
    Case 4
         objAppy.Body = "Subject 5"
    End Select

inputdata = InputBox("Please Enter Service Technican and Van Number in the FollowinG Format 14 MM/TS")
inputdata1 = InputBox("Please Enter a Descpiption of the Problem")
inputdata2 = InputBox("If a Man Lift is Required to Complete Service please note if lift will be provided by Beaton or Customer. If no Manlift is Needed enter Not Required")
inputdata3 = InputBox("Please Enter Company Hours of Operation to Complete Service")
inputdata4 = InputBox("Please Enter Location and Status of Required Parts if Applicable. Enter N/A if Not Applicable.")
inputdata5 = InputBox("Please Enter the Priority Level of Equipment Failure and Date Customer is Expecting Service")
inputdata6 = InputBox("Please Enter any Other Additional Notes Relevant to Service Request, Customer Expectation, and or Technical Details")
inputdata7 = InputBox("Add Dropbox Link for any Related File Attachments")

' Use Company for Location
If objContact.CompanyName <> "" Then
    objAppt.Subject = inputdata & " , " & inputdata5 & ", " & objContact.CompanyName & ", - OR - " & objContact.FullName & " , Phone: " & objContact.BusinessTelephoneNumber & " , Cell: " & objContact.MobileTelephoneNumber
' Use Business address if available, else home address
If objContact.BusinessAddress <> "" Then
    objAppt.Location = objContact.BusinessAddressStreet & "," & objContact.BusinessAddressCity & "," & objContact.BusinessAddressState & "," & objContact.BusinessAddressPostalCode
    strPhone = objContact.BusinessTelephoneNumber
  objAppt.Location = objContact.HomeAddressStreet & ", " & objContact.HomeAddressCity & " " & objContact.HomeAddressState & " " & objContact.HomeAddressPostalCode
    strPhone = objContact.HomeTelephoneNumber
End If
' Add contact's name and phone number to the body
    objAppt.Body = "DESCRIPTION OF PROBLEM: " & inputdata1 & vbNewLine & vbNewLine & "MANLIFT: " & inputdata2 & vbNewLine & vbNewLine & "HOURS OF OPERATION: " & inputdata3 & vbNewLine & vbNewLine & "REQUIRED PARTS AND STATUS: " & inputdata4 & vbNewLine & vbNewLine & "ADDITIONAL NOTES: " & inputdata6 & vbNewLine & vbNewLine & "FILE ATTACHMENTS: " & inputdata7

Set objAppointment = Nothing
If objAppointment Is Nothing Then
                With objAppt
                .AllDayEvent = True
                .BusyStatus = olBusy
  End With
End If

Set objContact = Nothing
Set oOL = Nothing

End If

End Sub
Any way of utilizing bot input boxes and combo boxes to the appt.body? Or any way for the userform to include both text box and combo box data to the appt.body?
It should work.... you need to use something like this:
for the cases:
Case -1
strBody = objAppt.Body
Case 0
strBody = "something else"

then use

objappt.body = strbody & vbcrlf & inputdata & vbcrlf & inputdata1...
Thanks Diane. Getting very close. As you stated, this method does seem to be working..... sort of. When run it is populating the aapt.body with both the data from the cobbo box plus the data from the text box. However, regarding the combo box it only pulls the Case 0 strbody which = "subject 1" If I select "subject 2",3,4, or 5 the macro still only grabs "subject 1". Its like it is ignoring the orher selections.

Still researching. Probably right in from of my face. Let me know your thoughts when time permits. Thanks for the assistance as always and happy holidays!
I am still coming up short on this. I sure you are sifting through numerous posts. Just wanted to see if you had any time to look into it a bit further as of yet.
Just checking in, anyone have any additional feedback on this?
do you have Public lstNo As Long at the very top of the module?
Public lstNo As Long

Sorry so log getting back to you. Had to back burner this for a minute. I did not have it at the top of the module. However I do now, and all is working as beautifully. Your the woman Diane. Thank you for your continued support and assistance.

I am having a few issues now getting multiple selections from a multi-select list box copied into an appointment however this is beginning a new topic so I will start a new thread on that.
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Using field names to capture a data element Using Outlook 0
Diane Poremsky Set Another Data File as Default When Using an Exchange Account Using Outlook 0
Diane Poremsky Create Appointments Using Spreadsheet Data Using Outlook 0
R can I transfer outlook data from old pc by using .ost file instead of the .pst Using Outlook 5
V Using custom field data in mail body + mailto hyperlink Outlook VBA and Custom Forms 7
S Using Send on Behalf is adding extra data in from line Using Outlook 1
R Disappearing data from outlook calendar after using icloud-ical Using Outlook 2
F Using Outlook 2007 as an IMAP Mail Station Without Saving Data Locally Using Outlook 2
M Scared to lose data using iCloud with Outlook 2007 Using Outlook 2
B Remove Outlook data file using another PC Using Outlook 1
P Using BCM2010 Business Projects as SharePoint 2007 Data Source BCM (Business Contact Manager) 3
I Can I share BCM V2 Database on 2003 by using BCM Data Admin Tool BCM (Business Contact Manager) 2
H using VBA to edit subject line Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Need clarification on 2-Step Verification for Gmail using Outlook 2021 Using Outlook 10
e_a_g_l_e_p_i Outlook 2021 not letting me setup my Gmail using pop Using Outlook 1
O How to find out the domain and server settings that my Outlook is using? Using Outlook 2
S Outlook 2019 Custom outlook Add-in using Visual Studio Outlook VBA and Custom Forms 0
D Outlook 2021 Using vba code to delete all my spamfolders not only the default one. Outlook VBA and Custom Forms 0
M using excel to sort outlook appointment items Outlook VBA and Custom Forms 4
R Advise on using multiple instances of network files based on customers Outlook VBA and Custom Forms 8
HarvMan Using Emojis in Outlook 365 Using Outlook 3
T Outlook 2019 Not Using Auto Compete After Deletion of 365 Using Outlook 1
T Outlook 2019 Using Gmail aliases in Outlook Using Outlook 6
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
Z Import Tasks from Access Using VBA including User Defined Fields Outlook VBA and Custom Forms 0
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
M Extract "Date sent" from emails (saved to folder using drag and drop) Outlook VBA and Custom Forms 1
I Outlook for Mac 2019 using on desktop and laptop IMAP on both need help with folders Using Outlook 1
David McKay VBA to manually forward using odd options Outlook VBA and Custom Forms 1
H Stationery using between OL 2019 and OL 2010 Using Outlook 0
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
O Calendar - Location: what happens when using my own way of entering locations Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
S Outlook VBA How to adapt this code for using in a different Mail Inbox Outlook VBA and Custom Forms 0
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
X Using Outlook 2013 and Outlook 365 Using Outlook 1
A Going to folder using shortcuts Using Outlook 3
A Outlook replies not using "delivered to" address in From Using Outlook 1
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 4
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
K Using Outlook 2016 to draw Using Outlook 1
O Outlook 365 - suddenly unable to send using Gmail POP3 Using Outlook 10
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1

Similar threads