Using Data From Combo Box in Appointment Body

Status
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?



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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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...
 

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
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!
 

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
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.
 

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Just checking in, anyone have any additional feedback on this?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
do you have Public lstNo As Long at the very top of the module?
 

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
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.
 
Status
Not open for further replies.
Thread starter Similar threads 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 New Slipstick.com Articles 0
Diane Poremsky Create Appointments Using Spreadsheet Data New Slipstick.com Articles 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
M Mail Merge email using data from MS Access Using Outlook 1
J problem when importing contact data from one computer to another using .pst file Using Outlook 2
J trouble importing Office 2003 contact data (activities,etc.) using .pst file export & import to a se Using Outlook 1
J Word 2003 mailmerge using Windows Mail contacts as a data source Using Outlook 1
I Can I share BCM V2 Database on 2003 by using BCM Data Admin Tool BCM (Business Contact Manager) 2
C Cannot recover my Outlook 2007 Data File after using MS Backup - Kinda Critical as I need my business info! Using Outlook 11
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 5
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
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Office 365 using POP3 on both laptop and desktop Using Outlook 0
B Vba to monitor time to respond to emails using a shared mailbox Outlook VBA and Custom Forms 5
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
O Using .OST and .PST mail thru different providers Using Outlook 5
N Open & Save VBAProject.Otm using VBA Code Outlook VBA and Custom Forms 1
D Remove text in subject using VBA Outlook VBA and Custom Forms 4
P How to export voting results using VBA? Outlook VBA and Custom Forms 2
E Using the Like operator properly Outlook VBA and Custom Forms 1
R Using "check for duplicates" for existing contacts Using Outlook 2
S Find a cell value in excel using outlook vba Using Outlook 1
N Using email notification to update calendar events? Outlook VBA and Custom Forms 4
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
C Sync Calendars using WiFI Using Outlook 3
A Capturing Send Variables without using Application_ItemSend in ThisOutlookSession Outlook VBA and Custom Forms 8
L Using alpha numeric in email address Using Outlook 5
Similar threads


















































Top