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?
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?
Code:
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("customerdb@beatonindustrial.com")
objOwner.Resolve
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
UserForm1.Show
' 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
Else
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
objAppt.Display
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