1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Option Explicit
Sub AddAppointments()
Dim myoutlook As Object ' Outlook.Application
Dim r As Long
Dim myapt As Object ' Outlook.AppointmentItem
Dim daterdv As Date
' late bound constants
Const olAppointmentItem = 1
Const olBusy = 2
Const olMeeting = 1
' Create the Outlook session
Set myoutlook = CreateObject("Outlook.Application")
' Start at row 2
r = 2
Do Until Trim$(Cells(r, 1).Value) = ""
' Create the AppointmentItem
Set myapt = myoutlook.CreateItem(olAppointmentItem)
' Set the appointment properties
With myapt
.Subject = Cells(r, 1).Value
.Start = Cells(r, 3).Value & " 9:00"
.End = Cells(r, 3).Value & " 10:00"
.Recipients.Add Cells(r, 4).Value
.MeetingStatus = olMeeting
.Body = "RDV POUR " & Cells(r, 1).Value
.Save
r = r + 1
.Send
End With
Loop
End Sub |
Partager