Macro conversion xlsm en PDF et envoie par mail de ce PDF

Bonjour, je suis novice dans les macros.

J'aimerais savoir s'il est possible de créer une macro pour convertir ce feuillet excell en PDF et de l'envoyer directement par email à une liste de destinataires.

Merci pour votre aide.

205antargaz.xlsm (451.76 Ko)

Salut,

Ci-joint des macro que j'utilise personnellement. Il faut l'adapter bien sur.

Sub Enregistrer_PDF()
Dim mois As String
mois = Range("C3").Value
Dim ann As String
ann = Range("B3").Value
Dim dest As String
dest = "destination du fichier"
If Dir(dest) = "" Then
MsgBox "Le répertoire de destination n'existe pas."
Exit Sub
End If

dest = "destination du fichier"

  With Sheets("Ligne éditoriale").PageSetup
    .LeftMargin = Application.InchesToPoints(0)
    .RightMargin = Application.InchesToPoints(0)
    .TopMargin = Application.InchesToPoints(0.5)
    .BottomMargin = Application.InchesToPoints(0)
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1
  End With
Sheets("Ligne éditoriale").ExportAsFixedFormat Type:=xlTypePDF, Filename:=dest
ThisWorkbook.FollowHyperlink dest
End Sub

Sub Envoyer_Mail_Outlook()
Dim ObjOutlook As New Outlook.Application
Dim oBjMail
Dim mois As String
mois = Range("C3").Value
Dim ann As String
ann = Range("B3").Value
Dim Nom_Fichier As String
Nom_Fichier = "Chemin entier du fichier"

If Dir(Nom_Fichier) = "" Then
Call Enregistrer_PDF
End If

    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

    If Nom_Fichier = "" Then Exit Sub
'---------------------------------------------------------
     With oBjMail
        .To = "Stadressemail@mail.com" ' le destinataire
        .CC = "copie@autremail.fr"
       .Subject = "OBJET DU MAIL" ' l'objet du mail
       .Body = "Bonjour, nanana, cordialement"  'le corps du mail ..son contenu
       .Attachments.Add Nom_Fichier '"CHEMIN DU FICHIER A METTRE EN PJ" ' ou Nomfichier
       .Display  '   Ici on peut supprimer pour l'envoyer sans vérification
      '.send ' pour envoyer le mail (perso je l'ai retiré pour vérification et personnalisation du mail)
    End With
    Set oBjMail = Nothing
    Set ObjOutlook = Nothing
End Sub
Rechercher des sujets similaires à "macro conversion xlsm pdf envoie mail"