Sub ResolveName()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Dim CalendarFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
'Set myRecipient = myNamespace.CreateRecipient("Dan Wilson")
'myRecipient.Resolve
'If myRecipient.Resolved Then
Call ShowCalendar(myNamespace, myRecipient)
'End If
End Sub
Sub ShowCalendar(myNamespace, myRecipient)
Dim Ad As String
Set MyMail = myRecipient.Items
longueur = MyMail.Count
Debug.Print longueur
For Each Item In MyMail 'i = 1 To longueur
'Set myItem = myRecipient.Items(i)
Debug.Print Item.SentOnBehalfOfName
If Item.SentOnBehalfOfName = "Centre appel" Then
Ad = "boite-BAL@adress.com"
Item.ReplyAll
'On Error Resume Next
Item.From = Ad
Item.To = Item.SentOnBehalfOfName
Item.Display
'Set LeMail = Application.CreateItemFromTemplate("C:\Users\CPE125\AppData\Roaming\Microsoft\Templates\Confirmation mail.oft")
'LeMail.Subject = "Confirmation de votre mail" '& vbCrLf & LeMail
' LeMail.To = Item.SentOnBehalfOfName
'LeMail.Display
'Item.Move myNamespace.Folders("Boîte aux lettres - Admin").Folders("DEMANDES").Folders("EN COURS")
End If
Next Item