A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Retrieve Meeting Response Text Associated with an Appointment



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old December 8th 09, 09:00 AM posted to microsoft.public.outlook.program_vba
Peter646
external usenet poster
 
Posts: 2
Default Retrieve Meeting Response Text Associated with an Appointment

How do I retrieve the text of meeting responses associated with an appointment?

I have redeveloped a macro which produces a word document listing the
meeting response status of invitees to an appointment. I would like, for
those who declined, to include the body of the meeting response (ie., where
the invitee has chosen to "Edit response before sending." While the Meeting
Response Status is a Recipient property, the text of the response is not.

Any ideas? I'm including the macro below:

Public Sub PrintAttendees()
' Gather data from an opened appointment and print to
' Word. This provides a way to print the attendee list with their
' response, which Outlook will not do on its own.

' Set up Outlook
Dim objApp As Outlook.Application
Dim objItem As Object
Dim objSelection As Selection
Dim objAttendees As Outlook.Recipients
Dim objAttendeeReqNR As String
Dim objAttendeeReqO As String
Dim objAttendeeReqT As String
Dim objAttendeeReqA As String
Dim objAttendeeReqD As String
Dim objAttendeeOptNR As String
Dim objAttendeeOptO As String
Dim objAttendeeOptT As String
Dim objAttendeeOptA As String
Dim objAttendeeOptD As String
Dim countAttendeeNR As Integer
Dim countAttendeeO As Integer
Dim countAttendeeT As Integer
Dim countAttendeeA As Integer
Dim countAttendeeD As Integer
Dim objOrganizer As String
Dim dtStart As Date
Dim dtEnd As Date
Dim strSubject As String
Dim strLocation As String
Dim strNotes As String
Dim strMeetStatus As String
Dim strUnderline As String ' Horizontal divider line


' Set up Word
Dim objWord As Object
Dim objdoc As Object
Dim wordRng As Object
Dim wordPara As Object

On Error Resume Next

Set objApp = CreateObject("Outlook.Application")
Set objItem = objApp.ActiveInspector.CurrentItem
Set objSelection = objApp.ActiveExplorer.Selection
Set objAttendees = objItem.Recipients

Set objWord = GetObject(, "Word.application")
If objWord Is Nothing Then
Set objWord = CreateObject("word.application")
End If

strUnderline = String(50, "_") ' use 50 underline characters

On Error GoTo EndClean:

' check for user problems with none or too many items open
Select Case objSelection.Count
Case 0
MsgBox "No appointment was opened. Please open one appointment."
GoTo EndClean:
Case Is 1
MsgBox "Too many items were selected. Just select one!!!"
GoTo EndClean:
End Select

' Is it an appointment
If objItem.Class 26 Then
MsgBox "You First Need To open The Appointment to Print."
GoTo EndClean:
End If

' Get the data
dtStart = objItem.Start
dtEnd = objItem.End
strSubject = objItem.Subject
strLocation = objItem.Location
strNotes = objItem.Body
objOrganizer = objItem.Organizer
objAttendeeReq = ""
objAttendeeOpt = ""
countAttendeeNR = 0
countAttendeeO = 0
countAttendeeT = 0
countAttendeeA = 0
countAttendeeD = 0

' Get The Attendee List
For x = 1 To objAttendees.Count
If objAttendees(x).Name = strLocation Then
GoTo EndofLoop
End If
strMeetStatus = ""
Select Case objAttendees(x).MeetingResponseStatus
Case 0
strMeetStatus = "No Response"
Case 1
strMeetStatus = "Organizer"
Case 2
strMeetStatus = "Tentative"
Case 3
strMeetStatus = "Accepted"
Case 4
strMeetStatus = "Declined"
End Select

If objAttendees(x).Type = olRequired Then
If objAttendees(x).MeetingResponseStatus = 0 Then
If objAttendees(x).Name = objOrganizer Then
objAttendeeReqO = objAttendeeReqO & objAttendees(x).Name & vbTab
& "Organiser" & vbCr
countAttendeeO = countAttendeeO + 1
Else
objAttendeeReqNR = objAttendeeReqNR & objAttendees(x).Name &
vbTab & strMeetStatus & vbCr
countAttendeeNR = countAttendeeNR + 1
End If
Else
If objAttendees(x).MeetingResponseStatus = 1 Then
objAttendeeReqO = objAttendeeReqO & objAttendees(x).Name & vbTab
& strMeetStatus & vbCr
countAttendeeO = countAttendeeO + 1
Else
If objAttendees(x).MeetingResponseStatus = 2 Then
objAttendeeReqT = objAttendeeReqT & objAttendees(x).Name &
vbTab & strMeetStatus & vbCr
countAttendeeT = countAttendeeT + 1
Else
If objAttendees(x).MeetingResponseStatus = 3 Then
objAttendeeReqA = objAttendeeReqA & objAttendees(x).Name
& vbTab & strMeetStatus & vbCr
countAttendeeA = countAttendeeA + 1
Else
objAttendeeReqD = objAttendeeReqD & objAttendees(x).Name
& vbTab & strMeetStatus & vbCr
countAttendeeD = countAttendeeD + 1
End If
End If
End If
End If
Else
If objAttendees(x).MeetingResponseStatus = 0 Then
objAttendeeOptNR = objAttendeeOptNR & objAttendees(x).Name & vbTab &
strMeetStatus & vbCr
countAttendeeNR = countAttendeeNR + 1
Else
If objAttendees(x).MeetingResponseStatus = 1 Then
objAttendeeOptO = objAttendeeOptO & objAttendees(x).Name & vbTab
& strMeetStatus & vbCr
countAttendeeO = countAttendeeO + 1
Else
If objAttendees(x).MeetingResponseStatus = 2 Then
objAttendeeOptT = objAttendeeOptT & objAttendees(x).Name &
vbTab & strMeetStatus & vbCr
countAttendeeT = countAttendeeT + 1
Else
If objAttendees(x).MeetingResponseStatus = 3 Then
objAttendeeOptA = objAttendeeOptA & objAttendees(x).Name
& vbTab & strMeetStatus & vbCr
countAttendeeA = countAttendeeA + 1
Else
objAttendeeOptD = objAttendeeOptD & objAttendees(x).Name
& vbTab & strMeetStatus & vbCr
countAttendeeD = countAttendeeD + 1
End If
End If
End If
End If
End If
EndofLoop:
Next

' Word: Open a new doc and fill it

objWord.Visible = True
Set objdoc = objWord.Documents.Add
Set objdoc = objWord.ActiveDocument
Set wordRng = objdoc.Range
objdoc.Paragraphs.TabStops.ClearAll
objdoc.Paragraphs.TabStops.Add Position:=180

With wordRng
.Font.Bold = True
.Font.Italic = False
.Font.Size = 14
.InsertAfter "Subject: " & strSubject
.InsertParagraphAfter
.InsertAfter strUnderline
.InsertParagraphAfter
.InsertParagraphAfter
End With

Set wordPara1 = wordRng.Paragraphs(4)
With wordPara1.Range
.Font.Bold = False
.Font.Italic = False
.Font.Size = 12
.InsertAfter "Organiser:" & vbTab & objOrganizer
.InsertParagraphAfter
.InsertAfter "Location:" & vbTab & strLocation
.InsertParagraphAfter
.InsertParagraphAfter
.InsertAfter "Start: " & dtStart
.InsertParagraphAfter
.InsertAfter "End: " & dtEnd
.InsertParagraphAfter
.InsertParagraphAfter
.InsertAfter "Required: "
.InsertParagraphAfter
.InsertAfter objAttendeeReqO
.InsertAfter objAttendeeReqA
.InsertAfter objAttendeeReqT
.InsertAfter objAttendeeReqNR
.InsertAfter objAttendeeReqD
.InsertParagraphAfter
.InsertAfter "Optional: "
.InsertParagraphAfter
.InsertAfter objAttendeeOptO
.InsertAfter objAttendeeOptA
.InsertAfter objAttendeeOptT
.InsertAfter objAttendeeOptNR
.InsertAfter objAttendeeOptD
.InsertParagraphAfter
End With

Set wordPara1a = wordRng.Paragraphs.Last
With wordPara1a.Range
.Font.Size = 12
.InsertAfter "Organiser:" & vbTab & countAttendeeO & vbCr
.InsertAfter "Accepted:" & vbTab & countAttendeeA & vbCr
.InsertAfter "Tentative:" & vbTab & countAttendeeT & vbCr
.InsertAfter "No Response:" & vbTab & countAttendeeNR & vbCr
.InsertAfter "Declined:" & vbTab & countAttendeeD & vbCr
.InsertParagraphAfter
End With

Set wordPara2 = wordRng.Paragraphs.Last
With wordPara2.Range
.Font.Size = 14
.InsertAfter strUnderline & vbCr
.InsertParagraphAfter
.InsertAfter "Notes" & vbCr
.InsertParagraphAfter
End With

Set wordPara3 = wordRng.Paragraphs.Last
With wordPara3.Range
.Font.Size = 12
.InsertAfter strNotes
End With

EndClean:
Set objApp = Nothing
Set objItem = Nothing
Set objSelection = Nothing
Set objAttendees = Nothing
Set objWord = Nothing
Set objdoc = Nothing
Set wordRng = Nothing
Set wordPara = Nothing

End Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
appointment response sent to disable account Beinmelb Outlook - Calandaring 1 April 28th 09 12:21 PM
Viewing Original Invite and Response when an Updated Appointment s Alison H Outlook - Calandaring 0 March 20th 09 08:39 PM
mailItem.HTMLBody should retrieve only current text Nagaraj Add-ins for Outlook 6 March 10th 09 01:21 PM
Updating appointment recipient's response status Jaz[_2_] Add-ins for Outlook 3 December 8th 08 05:06 PM
appointment response/ tracking dereks Outlook - Calandaring 2 October 4th 06 12:58 AM


All times are GMT +1. The time now is 03:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.