Autres [RESOLU] XL 2007 - envoie mail pdf adresses multiples en CC:

sergiofox

XLDnaute Junior
Re bonjour le forum, j'ai encore besoins de vous :)

Dans ma feuille j'ai créer un bouton avec une macro pour transformer ma feuille excel en PDF avec une adresse mail principale et je voudrais rajouter en CC: trois adresses mail qui se trouvent dans trois cellules différentes J37 , L37 , Q37 j'ai testé plusieurs exemples recherché dans les différents posts mais je n'y arrive pas, quelqu'un saurait t'il m"aider ?

Merci
VB:
Sub Mail()
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim destwb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim OutApp As Object
Dim OutMail As Object
Dim S As Shape
Dim sNomFic As String, sRep As String, WshShell As Object

With Application
    .ScreenUpdating = False
    .EnableEvents = False
End With

' Créer une instance Windows Script pour retrouver le chemin du bureau
Set WshShell = CreateObject("WScript.Shell")
sRep = WshShell.SpecialFolders("Desktop")
Set WshShell = Nothing
' Définit le nom du fichier à enregistrer
sNomFic = "test.pdf"
' Enregistrer la feuille en PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sRep & "\" & sNomFic, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False

Set OutApp = CreateObject("outlook.application")
Set OutMail = OutApp.CreateItem(0)
    With OutMail
        .To = "lebonheur.be"
        .Cc = " "
        .Attachments.Add (sRep & "\" & sNomFic)
        .Subject = "resultats"
        .Display
    End With
    
With Application
    .ScreenUpdating = True
    .EnableEvents = True
End With
Kill (sRep & "\" & sNomFic)
End Sub