Créer un code VBA pour générer des rappels automatiques dans Outlook

bonjour,

Je suis débutant mais intéressé par les fonctionnalités EXCEL VBA qui semblent pouvoir m'aider à organiser mes tâches dans le cadre de mon activité pro.

J'utilise un agenda Outlook pour mes rdv et je voudrais pouvoir générer un rappel automatique depuis EXCEL pour les rdv.

Ci-joint un tableau simplifié précisant les rappels que je souhaite intégrer automatiquement dans ma messagerie.

J'ai pu trouver ce code à partir de COPILOT

Sub CreateOutlookReminders()

Dim olApp As Outlook.Application

Dim olRem As Outlook.Reminder

Dim olRems As Outlook.Reminders

Dim olEvt As Outlook.AppointmentItem

Dim rng As Range

Dim strSubject As String

Dim dtStart As Date

Dim dtEnd As Date

Dim strBody As String

Dim strLocation As String

Dim strReminder As String

Dim intDuration As Integer

Dim intReminderMinutes As Integer

Dim intRow As Integer

Dim blnCreated As Boolean

Set olApp = New Outlook.Application

Set olRems = olApp.Reminders

For Each olRem In olRems

olRem.Dismiss

Next olRem

Set rng = ActiveSheet.Range("A2:D6")

For intRow = 1 To rng.Rows.Count

strSubject = rng.Cells(intRow, 1).Value

dtStart = rng.Cells(intRow, 2).Value + rng.Cells(intRow, 3).Value

dtEnd = dtStart + TimeValue("00:15:00")

strReminder = rng.Cells(intRow, 4).Value

Select Case strReminder

Case "15 minutes avant"

intReminderMinutes = 15

Case "30 minutes avant"

intReminderMinutes = 30

Case "1 heure avant"

intReminderMinutes = 60

Case "2 heures avant"

intReminderMinutes = 120

Case Else

intReminderMinutes = 0

End Select

Set olEvt = olApp.CreateItem(olAppointmentItem)

With olEvt

.Subject = strSubject

.Start = dtStart

.End = dtEnd

.ReminderMinutesBeforeStart = intReminderMinutes

.Save

End With

blnCreated = True

Next intRow

If blnCreated Then

MsgBox "Les rappels ont été créés avec succès!", vbInformation

Else

MsgBox "Aucun rappel n'a été créé.", vbInformation

End If

Set olEvt = Nothing

Set olRems = Nothing

Set olRem = Nothing

Set olApp = Nothing

End Sub

Cependant si je veux exécuter le code

j'ai ce message d'erreur ci-dessous. Pouvez-vous m'aider ?

Merci :-)

image

Bonsoir,

Dans le code VBA, il faut aller dans le menu Outils>Références...:

image

Puis cocher cette référence:

image

Bonne soirée

Rechercher des sujets similaires à "creer code vba generer rappels automatiques outlook"