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 33 34 35 36 37 38 39 40 41 42 43 44
| 'https://www.developpez.net/forums/d2130473/logiciels/microsoft-office/excel/macros-vba-excel/supprimer-rendez/#post11834068Sub REUNION_SABLIER()
Dim OlApp As Outlook.Application
Dim olAppItem As Outlook.AppointmentItem
Dim DEBUT, FIN, L&, LR&
Set OlApp = CreateObject("Outlook.Application")
'Il vaut mieux préciser le classeur sur lequel tu travailles
'With ThisWorkbook.Worksheets("Feuil1")
'Ou plus simplement utiliser le codename de la feuille
With Feuil1
LR = .Cells(.Rows.Count, 14).End(xlUp).Row
For L = 23 To 194
'Pour faciliter la lecture/modification du code, Cells accepeter les nom de colonne en lettre 'je ne modifie pas tout
If .Cells(L, "W") <> "" And .Cells(L, "O") = "" Then
DEBUT = DateValue(.Cells(L, "W")) + .Cells(L, 17)
FIN = DateValue(.Cells(L, "W")) + .Cells(L, 18)
Set olAppItem = OlApp.CreateItem(olAppointmentItem)
With olAppItem
.Body = Feuil1.Cells(L, 21)
.ReminderSet = True
.BusyStatus = olFree
.Start = DEBUT
.End = FIN
.Subject = Feuil1.Cells(L, 19)
.Save
End With
.Cells(L, 15) = "RDV créé"
.Cells(L, 14).Value = olAppItem.ConversationIndex
End If
Next L
End With
Set olAppItem = Nothing
Set OlApp = Nothing
End Sub |
Partager