southcali12

New Member
Joined
Sep 22, 2015
Messages
28
Hi Everyone,

I am sending out Outlook appointments via a spreadsheet where all the data/information is stored. However, the issue I am running into is: when I need to send out multiple information to the same email address for a client, I want the client to get all of the information in the one appointment's body, and not send out out X amount of emails to the same client with different information.

For example in the sample below, I'd want the rows with Alaska-5 to be sent in one appointment body, and the row with Alaska-6 to be sent in another appointment body.

Example of what spreadsheet looks like (the other columns are filled with other information):

Column DColumn GColumn HColumn IColumn KColumn NColumn OColumn PColumn Q
SiteClientSupervisorDateClient TimeClient TicketSite EmailAppointment StartPhone Number
Alaska-5Doe,JohnAdam,Joe11/8/20151500123456Alaska-5@123.com11/8/2015 15:00(800)123-4567
Alaska-6Smith,Mary
Smith,John

<tbody>
</tbody>
11/8/2015

<tbody>
</tbody>
1900

<tbody>
</tbody>
3456789Alaska-6@123.com11/8/2015 15:30(800)123-4567
Alaska-5White,BettyAdam,Joe
11/8/2015

<tbody>
</tbody>
1530

<tbody>
</tbody>
564897Alaska-5@123.com11/8/2015 17:00(800)123-4567

<tbody>
</tbody>


Code:
Sub SetAppt()
'Want it to filter by site and hour, and send out one appointment per site/hour
Dim olApt As Object
Dim olApp As Object
Dim i As Long
Dim apptRange As Variant

Const olAppointmentItem As Long = 1
Set olApp = GetOutlookApp

' read appts into array
apptRange = Range(Cells(2, 1), Cells(Rows.Count, 17).End(xlUp)).Value

For i = LBound(apptRange) To UBound(apptRange)
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.RequiredAttendees = apptRange(i, 15)
.Start = apptRange(i, 16)
.Duration = "60"
.Subject = "Subject"
.body = "Hello " & apptRange(i, 4) & "," & vbCrLf & vbCrLf & "Looking forward to speaking with you:" & vbCrLf & vbCrLf & _
"Client: " & vbCrLf & "Time: " & apptRange(i, 10) & vbCrLf & "Date: " & apptRange(i, 9) & vbCrLf & vbCrLf & _
"Phone Number: " & apptRange(i, 17) & vbCrLf & vbCrLf & _
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = "30"
.ReminderSet = True
.Importance = olImportanceHigh
.display
End With

Next

End Sub
Function GetOutlookApp() As Object
On Error Resume Next
Set GetOutlookApp = CreateObject("Outlook.Application")
End Function
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
sorting the data by site and hour as a start would be useful

Then just track that changes in the values that matter to you

Code:
ThisSite=""
ThisHour=""

For i = LBound(apptRange) To UBound(apptRange)
If ThisSite<>apptRange(i,4) or ThisHour<> apptRange(i,15) and ThisSite<>"" then 
.display  ' as in send the appointment
ThisSite=apptRange(i,4)
ThisHour = apptRange(i,15)
endif
now start processing the next appointment

at the end after the loop

.display to send the last email
 
Upvote 0

Forum statistics

Threads
1,215,845
Messages
6,127,259
Members
449,372
Latest member
charlottedv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top