Bonjour le forum
Je reviens vers vous car j' avais posté une discussion concernant l' envoi de mail avec pièce jointe en pdf.
Serait il possible que vous m' aidiez à utiliser le même code qui marche parfaitement mais au lieu d' avoir le fichier en pdf il serait en xls
En fait je m' explique, j' aimerais créer un mail et envoyer l' onglet du classeur en xls
Ci-joint le code ci-dessous à remodifier
Merci à vous tous
Private Sub CommandButton2_Click()
Dim destinataire, sujet, fichierjoint As String
destinataire = "cerise@free.fr"
sujet = "Fichier " & Range("D9").Value
 
Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:=ActiveWorkbook.Path & "\" & "Sheet1.pdf"
text1 = " Bonjour " & "<br>"
text2 = "<br>"
text3 = " Je te prie de trouver ci-joint le fichier en pdf " & "<br><br>"
text4 = "Bien Cordialement" & "<br><br>"
text5 = "Salah" & "<br><br>"
text6 = "Tél.: 01-45-23-12-11"
   
Body = text1 & text2 & text3 & text4 & text5 & text6
    
fichierjoint = "C:\Users\Salah\Desktop\donnees\Sheet1.xls"
 
strcommand = "C:\Program Files (x86)\Mozilla Thunderbird\Thunderbird.exe"
strcommand = strcommand & " -compose " & "to='" & destinataire & "'"
strcommand = strcommand & "," & "subject=" & sujet & ","
strcommand = strcommand & "body=" & Body
strcommand = strcommand & "," & "attachment=file:///" & fichierjoint
'MsgBox strcommand
 
Call Shell(strcommand, vbNormalFocus)
 
End Sub
	
		
			
		
		
	
				
			Je reviens vers vous car j' avais posté une discussion concernant l' envoi de mail avec pièce jointe en pdf.
Serait il possible que vous m' aidiez à utiliser le même code qui marche parfaitement mais au lieu d' avoir le fichier en pdf il serait en xls
En fait je m' explique, j' aimerais créer un mail et envoyer l' onglet du classeur en xls
Ci-joint le code ci-dessous à remodifier
Merci à vous tous
Private Sub CommandButton2_Click()
Dim destinataire, sujet, fichierjoint As String
destinataire = "cerise@free.fr"
sujet = "Fichier " & Range("D9").Value
Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:=ActiveWorkbook.Path & "\" & "Sheet1.pdf"
text1 = " Bonjour " & "<br>"
text2 = "<br>"
text3 = " Je te prie de trouver ci-joint le fichier en pdf " & "<br><br>"
text4 = "Bien Cordialement" & "<br><br>"
text5 = "Salah" & "<br><br>"
text6 = "Tél.: 01-45-23-12-11"
Body = text1 & text2 & text3 & text4 & text5 & text6
fichierjoint = "C:\Users\Salah\Desktop\donnees\Sheet1.xls"
strcommand = "C:\Program Files (x86)\Mozilla Thunderbird\Thunderbird.exe"
strcommand = strcommand & " -compose " & "to='" & destinataire & "'"
strcommand = strcommand & "," & "subject=" & sujet & ","
strcommand = strcommand & "body=" & Body
strcommand = strcommand & "," & "attachment=file:///" & fichierjoint
'MsgBox strcommand
Call Shell(strcommand, vbNormalFocus)
End Sub