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
| Dim oOutlook As Outlook.Application
Dim oAppointment As Outlook.AppointmentItem
Dim namespaceOutlook As Outlook.Namespace
Dim DossierCalendrier
'gestion d'erreurs
' On Error GoTo Err_Execution
'on crée ensuite les objets
Set oOutlook = CreateObject("Outlook.Application")
Set namespaceOutlook = oOutlook.GetNamespace("MAPI")
Set DossierCalendrier = namespaceOutlook.GetDefaultFolder(olFolderCalendar).Folders("REAL TN HN")
' Set oItems = oCalendar.Items
'on crée un nouveau rendez-vous
Set oAppointment = DossierCalendrier.Items.Add
'on renseigne ensuite les principaux paramètres
With oAppointment
.Start = #2/29/2020 1:30:00 PM#
.Duration = 600 'durée de rdv, en minutes
.Subject = "TEST"
.Body = "test d calebdrier partageé"
.OptionalAttendees = "a@a.com"
' .Location = TextBox4.Value & TextBox5.Value 'Lieu du rdv
'on sauvegarde et ferme
.Save
.Display
' .Close (olSave)
End With
'Libération des variables.
Set oAppointment = Nothing
Set oOutlook = Nothing
Fin_Execution:
Exit Sub
End Sub |
Partager