Bonjour,

Je fais une macro pour générer des rdv dans outlook depuis des dates et infos d'un fichier excel,
J'y arrive (merci internet !) mais le souci est qu'à chaque fois que j'exécute la macro pour tester, je me mets plusieurs fois le même rdv dans outlook.
Sauriez-vous svp comment je pourrai tester si le rdv existe déjà à la date pour ne pas le créer de nouveau ?
Ou le supprimer par macro avant de le créer ?
voici un extrait de mon fichier :
Nom : Sans titre.png
Affichages : 178
Taille : 27,0 Ko

et voici "mon" code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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