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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
Sub CreationReunion()
'---------------------------------------------------------------------------------------
' Procédure : CreationReunion
' Auteur : Dolphy35 - http://dolphy35.developpez.com/
' Date : 16/05/2008
' Détail : Création d'une nouvelle entrée du calendrier'---------------------------------------------------------------------------------------
'Déclaration des objets
Dim objOutlook As Outlook.Application
Dim objReunion As Outlook.AppointmentItem
Dim objExplorer As Outlook.Explorer
Dim objSelection As Outlook.Selection
Dim objMail As Object
Dim strMail As String
Dim strSujet As String
Dim strDate As String
'Instance des Objets
Set objOutlook = Outlook.Application 'Instance de l'application
Set objExplorer = objOutlook.ActiveExplorer
Set objSelection = objExplorer.Selection
Set objReunion = objOutlook.CreateItem(olAppointmentItem) 'Instance de la nouvelle entrée du calendrier
'Récupère les infos du mail reçu
For Each objMail In objSelection
With objMail
strMail = .SenderEmailAddress
strSujet = .Subject
strDate = .ReceivedTime
End With
'Déplacement du mail et création du raccourci
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.MAPIFolder
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox).parent
Set myDestFolder = myInbox.Folders("Dossiers d'archivage")
Myentryid = objMail.EntryID
Set objMail = objMail.Move(myDestFolder)
'définition de la réunion
With objReunion
.MeetingStatus = olMeeting
.Subject = strSujet
.Location = "Mon Bureau"
.Recipients.Add (strMail)
.Body = "-selon votre demande du " + strDate + "." + Chr(13) + Chr(13) + "Voici comment traiter ce mail:" + Chr(13) + "-ouvrez ce mail avec Outlook ou https://webmail.heig-vd.ch" + Chr(13) + "-cliquez sur les boutons Accepter/Refuser/etc qui apparaissent en haut à gauche du mail selon votre disponibilité" + Chr(13) + "" + Chr(13) + ""
.Attachments.Add objMail, olOLE, , objMail.Subject
.Display
End With
Next
'Vide des instances
Set objOutlook = Nothing
Set objReunion = Nothing
Set objExplorer = Nothing
Set objSelection = Nothing
End Sub |
Partager