XL 2016 Créer pdf avec nom défini dans une cellule

hijackfr

XLDnaute Nouveau
Bonjour,

je sais que ma demande n'est pas nouvelle mais j'aimerai vraiment comprendre ce que je loupe dans mon fichier.
J'ai un document excel dans lequel j'ai ajouté trois boutons avec des fonctions différentes(Création pdf; Création pdf et envoi mail; envoi mail) et le tout rattaché à du code vba. J'ai pour cela ajouter trois modules. Formules données par un certain Ron sur Internet.
Le tout fonctionne bien mais j'aimerai qu'à la création du pdf ce dernier renseigne automatiquement un nom d'après les champs d'une cellule.
Pour l'instant je sèche, j'ai beau modifié le code dans le module CreatePDF je n'y arrive pas

voilà le code

Code:
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
    Dim FileName As String

    If ActiveWindow.SelectedSheets.Count > 1 Then
        MsgBox "There is more then one sheet selected," & vbNewLine & _
               "be aware that every selected sheet will be published"
    End If

    'Call the function with the correct arguments
    'Tip: You can also use Sheets("YourSheetName") instead of ActiveSheet in the code(sheet not have to be active then)
    FileName = RDB_Create_PDF(Source:=ActiveSheet, _
                              FixedFilePathName:="", _
                              OverwriteIfFileExist:=True, _
                              OpenPDFAfterPublish:=True)

    'For a fixed file name use this in the FixedFilePathName argument
    'FixedFilePathName:="C:\Users\Ron\Test\YourPdfFile.pdf"

    If FileName <> "" Then
        'Ok, you find the PDF where you saved it
        'You can call the mail macro here if you want
    Else
        MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
               "Microsoft Add-in is not installed" & vbNewLine & _
               "You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
               "The path to Save the file in arg 2 is not correct" & vbNewLine & _
               "You didn't want to overwrite the existing PDF if it exist"
    End If
End Sub

si quelqu'un pouvait m'aider, merci
Je mets le fichier en pièce jointe
 

Pièces jointes

  • Facture_3.xlsm
    91.5 KB · Affichages: 24

Discussions similaires

Réponses
8
Affichages
591

Statistiques des forums

Discussions
312 244
Messages
2 086 555
Membres
103 247
dernier inscrit
bottxok