Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CalendarInvite()
- Dim Rng As Range, strFileName As String, strRecipient As String
- Dim strSubject As String, strBody As String
- Set myoutlook = CreateObject("Outlook.Application")
- For Each Rng In Range("tblData[Status]")
- If Rng = "To be Sent" Then
- Set myapt = myoutlook.CreateItem(olAppointmentItem)
- strSubject = Cells(Rng.Row, Range("tblData[Subject]").Column)
- strFileName = "C:UsersTestDownloadsCalendarInvites" & _
- Cells(Rng.Row, Range("tblData[Email]").Column) & ".ics"
- strRecipient = Cells(Rng.Row, Range("tblData[Email]").Column)
- strBody = "Test Mail Body"
- With myapt
- .MeetingStatus = olMeeting
- .Subject = " Wedding Reception - Ramya & Mohan "
- .Location = " PJN Mahal, #10, Egabaram Salai, Udaya Nagar, Porur, Chennai 116 "
- .Start = "28-12-2013 07:00 PM"
- .Duration = 150
- .AllDayEvent = "False"
- .BusyStatus = "2"
- .ReminderSet = True
- .ReminderMinutesBeforeStart = 2880
- .ResponseRequested = True
- .Body = strBody
- End With
- Set myRequiredAttendee = myapt.Recipients.Add(strRecipient)
- myRequiredAttendee.Type = olRequired
- With myapt
- .SaveAs strFileName, olICal
- .Delete
- End With
- Set mymail = myoutlook.CreateItem(olMailItem)
- With mymail
- .To = strRecipient
- .Subject = strSubject
- .Body = strBody
- .Importance = olImportanceHigh
- .ReadReceiptRequested = True
- .Attachments.Add strFileName
- If Cells(Rng.Row, Range("tblData[Attachment]").Column) = "Yes" Then
- mymail.Attachments.Add "D:Directions-PJNMahal.jpg"
- End If
- .Send
- End With
- Rng = "Sent, Subject to Delivery"
- End If
- Next Rng
- End Sub
Add Comment
Please, Sign In to add comment