vonjour,
je souhaite recuperer mes mail de outlook vers excel.
Voila le code que j'ai fait :
Sub transfertMailsDansExcel()
'necessite d'activer la reference Microsoft Outlook xx Object library
Dim OLapp As Outlook.Application
Dim OLspace As Outlook.nameSpace
Dim OLinbox As Outlook.MAPIFolder
Dim OLmail As Outlook.mailItem
Dim OLbody As String
Dim i As Integer
Set OLapp = CreateObject("Outlook.application" )
Set OLspace = OLapp.getNamespace("MAPI" )
Set OLinbox = OLspace.getDefaultFolder(olFolderInbox) 'boite de reception
For Each OLmail In OLinbox.Items
i = i + 1
If Left(OLmail.SentOn, 10) = Date Then
Cells(i, 1) = OLmail.SenderName
Cells(i, 2) = Replace(OLmail.body, Chr(13), " " )
End If
Next OLmail
End Sub
Mais j'ai l'erruer suivante : 'type mismatch' au niveau de next OLmail !
Help me
Merci Beaucoup