Relation entre Excel et agenda Outlook
Bonjour à tous,
J'ai actuellement créer une macro qui me permet de mettre en relation mon tableau excel (2010) et ma messagerie outlook,
le but étant de recevoir des notifications pour mes relances, rendez-vous et autres.
Le problème et qu'à chaque fois que je remet à jours mon fichier, je doit effectuer la macro, et la macro recommence pour toutes les données. Cela me double donc à chaque fois chaque relances et rendez- vous dans ma messagerie outlook.
J'aimerai que cette macro marche uniquement pour les informations que j'ai rajouter depuis la dernière sauvegarde.
Voici ce que j'ai actuellement :
Sub relance()
Const olAppointmentItem As Long = 1
Dim OLApp As Object
Dim OLNS As Object
Dim OLAppointment As Object
On Error Resume Next
Set OLApp = GetObject(, "Outlook.Application")
If OLApp Is Nothing Then Set OLApp = CreateObject("Outlook.Application")
On Error GoTo 0
If Not OLApp Is Nothing Then
Set OLNS = OLApp.GetNamespace("MAPI")
OLNS.Logon
For i = 2 To 1000
If Range("k" & i) <> 0 Then
Set OLAppointment = OLApp.CreateItem(olAppointmentItem)
OLAppointment.Subject = "Relance" & Range("D" & i) & Range("e" & i) & Range("g" & i)
OLAppointment.Body = "Relance" & Range("D" & i) & Range("e" & i) & Range("g" & i)
OLAppointment.Start = Range("k" & i)
OLAppointment.Duration = 60
OLAppointment.ReminderMinutesBeforeStart = 30
OLAppointment.Save
Set OLAppointment = Nothing
End If
Next i
Set OLNS = Nothing
Set OLApp = Nothing
End If
End Sub
Merci de votre aide et bonne journée.