PDA

View Full Version : Outlook Attendee macro



Alasbabylon
01-14-2008, 10:13 AM
Hi, I got a lot of help from this forum in developing this macro to pull the attendee list and accept/decline information from a calendar item. What I'd like to do with it now though, is to have it save the text file out using the meeting maker subject line as the file name. Is that possible>

Sub MeetingInfo()
Dim ai As Outlook.AppointmentItem
Dim tempstring As String
Dim r As Recipient
Dim mrs As String
Dim fs As Object
Dim a
'if there is one item selected and it's an appointment...
If ActiveExplorer.Selection.Count = 1 And _
ActiveExplorer.Selection.Item(1).Class = olAppointment Then
Set ai = ActiveExplorer.Selection.Item(1)
'go through the various properties and output them
With ai
'build a string with the meeting summary
tempstring = tempstring & "Subject: " & .Subject & Chr(13)

tempstring = tempstring & "Start time: " & .Start & Chr(13)
tempstring = tempstring & "Organizer: " & .Organizer & Chr(13)
tempstring = tempstring & "Number of attendees: " & .Recipients.Count & Chr(13) & Chr(13)
End With
'add to the string a recipient response list
For Each r In ai.Recipients
Select Case r.MeetingResponseStatus
Case olResponseAccepted
mrs = "Accepted"
Case olResponseDeclined
mrs = "Declined"
Case olResponseNone
mrs = "None"
Case olResponseNotResponded
mrs = "Responded"
Case olResponseOrganized
mrs = "Organized"
Case olResponseTentative
mrs = "Tentative"
End Select
tempstring = tempstring & r.Name & Chr(9)
tempstring = tempstring & mrs & Chr(13)
Next
'save result as a text file
Set fs = CreateObject("Scripting.FileSystemObject")
'!!!~~~you might want to change the path and name here~~~!!!
Set a = fs.CreateTextFile("C:\Documents and Settings\maa5906\My Documents\AAA\meetinglist.doc", True)
a.WriteLine tempstring
a.Close
End If
End Sub