XL 2021 Exporter en PDF avec nom dynamique

fuioplde

XLDnaute Nouveau
Bonjour,

Je sollicite votre aide, car j'ai créé un Excel où je peux rentrer des frais postaux et imprimer puis exporter le fichier en PDF. Cependant, je souhaiterais que l'exportation prenne le nom : " Frais postaux + nom de la copro + la date de fin".
mon code :

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="E:\TEST\FP_Nom_Copro.pdf", _
OpenAfterPublish:=False
Application.ScreenUpdating = True
End Sub


Merci beaucoup
 

Pièces jointes

  • Classeur1.xlsm
    26.8 KB · Affichages: 4

sylvanu

XLDnaute Barbatruc
Supporter XLD
Bonjour Fuioplde,
Un essai en PJ avec :
VB:
Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    NomPDF = "E:\TEST\" & [E9] & "_" & [G12] & ".pdf"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            Filename:=NomPDF, _
            OpenAfterPublish:=False
    Application.ScreenUpdating = True
End Sub

NB: Pouyr le code utilisez la balise </> à droite de l'icone GIF, c'est plus lisible. :)
 

Pièces jointes

  • Classeur1 (1).xlsm
    26.8 KB · Affichages: 8

Discussions similaires

Statistiques des forums

Discussions
312 209
Messages
2 086 259
Membres
103 167
dernier inscrit
miriame