Microsoft 365 Envoi document Excel en PDF par mail

  • Initiateur de la discussion Initiateur de la discussion rubis54
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

rubis54

XLDnaute Occasionnel
Bonjour Tout le monde

J'ai un petit soucis avec ma macro qui envoie ma feuille "commande" par mail.

Alors elle me l'enregistre en pdf.

Lorsque j'appuis sur le bouton mail elle ouvre ma boite boite mail et on voit

que la pièce jointe en PDF est bien ma feuille "commande".

Ce que j'aurai souhaité c'est qu'au moment ou j'appuis le bouton mail,

qu'elle me laisse choisir le destinataire dans la liste en page données,

ou alors qu'elle le prenne en cellule "G3" de la feuille "commande",

qui est reliée via une "rechercheV au fournisseur" cellule "I2".

Alors est ce quelqu'un de vous pourrait bien m'aider à mettre ça en place SVP.

Je vous Remercie d'avance
 

Pièces jointes

Solution
Salut,
VB:
Sub EnvoiPDF()
  Dim Nom As String
  Nom = ActiveSheet.Name & ".pdf"
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    ActiveWorkbook.Path & "\" & Nom, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
  Set olApp = CreateObject("Outlook.application")
  Set m = olApp.CreateItem(0)
  With m
    .to = ActiveSheet.[G3]
    .Attachments.Add ActiveWorkbook.Path & "\" & Nom
    .Display
  End With
End Sub
Salut,
VB:
Sub EnvoiPDF()
  Dim Nom As String
  Nom = ActiveSheet.Name & ".pdf"
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    ActiveWorkbook.Path & "\" & Nom, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
  Set olApp = CreateObject("Outlook.application")
  Set m = olApp.CreateItem(0)
  With m
    .to = ActiveSheet.[G3]
    .Attachments.Add ActiveWorkbook.Path & "\" & Nom
    .Display
  End With
End Sub
 
Salut,
VB:
Sub EnvoiPDF()
  Dim Nom As String
  Nom = ActiveSheet.Name & ".pdf"
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    ActiveWorkbook.Path & "\" & Nom, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
  Set olApp = CreateObject("Outlook.application")
  Set m = olApp.CreateItem(0)
  With m
    .to = ActiveSheet.[G3]
    .Attachments.Add ActiveWorkbook.Path & "\" & Nom
    .Display
  End With
End Sub
Salut Fanch55,
J'ai mis ton code en place et tout fonctionne.
Merci à toi.👍
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
16
Affichages
1 K
Réponses
2
Affichages
717
Réponses
3
Affichages
819
Retour