tommyonegun
New Member
- Joined
- Aug 20, 2015
- Messages
- 25
I have the vba worked out to create the appointment with no issues.
It works great. Where I get lost is myApt.Body = "Tasks". That's just a place holder for now. What I want to do is grab every row, columns A:D, where the value in D equals ActiveCell.Value, and list those results in the body of the email instead of "Tasks". I've tried a few things and searched the forum with no results. Any help would be greatly appreciated. An example of the Spreadsheet is below. In the real sheet there is a bunch of data off to the right. Essentially I highlight the day of the week I'm creating the meeting for in Column F, and run the Macro. It confirms the date and creates a summary meeting with the total hours for that day in the Subject. Now I just need the other detail in the body of the meeting.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]Client[/TD]
[TD]Task Detail[/TD]
[TD]Hrs[/TD]
[TD]Day[/TD]
[TD][/TD]
[TD]Meeting Day[/TD]
[/TR]
[TR]
[TD]Client 1[/TD]
[TD]Task 1[/TD]
[TD]2[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Monday[/TD]
[/TR]
[TR]
[TD]Client 2[/TD]
[TD]Task 2[/TD]
[TD]3[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Tuesday[/TD]
[/TR]
[TR]
[TD]Client 3[/TD]
[TD]Task 3[/TD]
[TD]1[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Wednesday[/TD]
[/TR]
[TR]
[TD]Client 4[/TD]
[TD]Task 4[/TD]
[TD]4[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Thursday[/TD]
[/TR]
[TR]
[TD]Client 5[/TD]
[TD]Task 5[/TD]
[TD]4[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Friday[/TD]
[/TR]
[TR]
[TD]Client 6[/TD]
[TD]Task 6[/TD]
[TD]3[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Saturday[/TD]
[/TR]
[TR]
[TD]Client 7[/TD]
[TD]Task 7[/TD]
[TD]2[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Sunday[/TD]
[/TR]
[TR]
[TD]Client 8[/TD]
[TD]Task 8[/TD]
[TD]2[/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client 9[/TD]
[TD]Task 9[/TD]
[TD]1[/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub Makeapt()
Dim warning
warning = MsgBox("You are about to create Outlook appointments for " & ActiveCell.Value & " " & Cells(ActiveCell.Row, 10) & ". Is that right?", vbOKCancel)
If warning = vbCancel Then Exit Sub
Set myOutlook = CreateObject("Outlook.Application")
Set ID = Cells(ActiveCell.Row, 10)
Set myApt = myOutlook.createitem(1)
myApt.Subject = ID & " " & Cells(ActiveCell.Row, 7) & " Hours Booked"
myApt.Start = Cells(ActiveCell.Row, 10) & " 6:00:00 PM"
myApt.End = Cells(ActiveCell.Row, 10) & " 7:00:00 PM"
myApt.Body = "Tasks"
myApt.Save
End Sub
It works great. Where I get lost is myApt.Body = "Tasks". That's just a place holder for now. What I want to do is grab every row, columns A:D, where the value in D equals ActiveCell.Value, and list those results in the body of the email instead of "Tasks". I've tried a few things and searched the forum with no results. Any help would be greatly appreciated. An example of the Spreadsheet is below. In the real sheet there is a bunch of data off to the right. Essentially I highlight the day of the week I'm creating the meeting for in Column F, and run the Macro. It confirms the date and creates a summary meeting with the total hours for that day in the Subject. Now I just need the other detail in the body of the meeting.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]Client[/TD]
[TD]Task Detail[/TD]
[TD]Hrs[/TD]
[TD]Day[/TD]
[TD][/TD]
[TD]Meeting Day[/TD]
[/TR]
[TR]
[TD]Client 1[/TD]
[TD]Task 1[/TD]
[TD]2[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Monday[/TD]
[/TR]
[TR]
[TD]Client 2[/TD]
[TD]Task 2[/TD]
[TD]3[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Tuesday[/TD]
[/TR]
[TR]
[TD]Client 3[/TD]
[TD]Task 3[/TD]
[TD]1[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Wednesday[/TD]
[/TR]
[TR]
[TD]Client 4[/TD]
[TD]Task 4[/TD]
[TD]4[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Thursday[/TD]
[/TR]
[TR]
[TD]Client 5[/TD]
[TD]Task 5[/TD]
[TD]4[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Friday[/TD]
[/TR]
[TR]
[TD]Client 6[/TD]
[TD]Task 6[/TD]
[TD]3[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Saturday[/TD]
[/TR]
[TR]
[TD]Client 7[/TD]
[TD]Task 7[/TD]
[TD]2[/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Sunday[/TD]
[/TR]
[TR]
[TD]Client 8[/TD]
[TD]Task 8[/TD]
[TD]2[/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client 9[/TD]
[TD]Task 9[/TD]
[TD]1[/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Last edited: