Option Explicit
'Il faut activer la référence "Microsoft Outlook Library" Avant de lancer cette macro,
' Dans l'éditeur VBA: Faire Menu / Tools / Reference / Cocher "Microsoft Outlook Library"
Sub Test()
Dim ObjOutlook As New Outlook.Application
Dim oBjMail
Dim i As Long, str As String, corps As String, _
dest As String, Nom_Fichier As String
Set ObjOutlook = New Outlook.Application
Set oBjMail = ObjOutlook.CreateItem(olMailItem)
'---------------------------------------------------------
'Exemple pour envoyer un classeur en pièce jointe
'Nom_Fichier = Application.GetOpenFilename("Fichier excel (*.xls;*.xlsx;*.xlsm), *.xls;*.xlsx;*.xlsm")
'If Nom_Fichier = "Faux" Then Exit Sub
'---------------------------------------------------------
'Ou bien entrer le path et nom du fichier autrement
Nom_Fichier = "C:\Chemin\NomFichier.ext"
If Nom_Fichier = "" Then Exit Sub
'---------------------------------------------------------
With Feuil1
For i = 11 To 30
str = str & .Cells(i, 2) & vbLf
Next i
End With
dest = Sheets("Data").Range("o2").Value 'adresse email du destinataire
corps = "Bonjour," & vbLf & vbLf & "Voici les références: " & vbLf & vbLf & str
With oBjMail
.To = dest 'le destinataire
.Subject = "Comte rendu du " & Format(Date, "dd mmmm yyyy") ' l'objet du mail
.Body = corps 'le corps du mail ..son contenu
'.Attachments.Add Nom_Fichier ' "C:\Data\essai.txt" ou Nomfichier
.Display 'ici on peut supprimer pour l'envoyer sans vérification
'.Send
End With
'ObjOutlook.Quit
Set oBjMail = Nothing
Set ObjOutlook = Nothing
End Sub