Bonjour st1,
Voir fichier ci-joint mais au cas où vous ne pourriez pas l'ouvrir (pbm de version), nommez une cellule quelconque "V_NOM_FICHIER" dans laquelle vous pourrez renseigner un nom de fichier (il sera proposé par défaut), copiez le code ci-dessous dans un module et définissez une forme associée à la macro ExportPdf.
Sub ExportPdf()
Dim dlgFile As FileDialog
Dim objFltr As FileDialogFilter
Dim nIdxFltr As Integer
Dim cFNomPdf As String
Dim wsXls2Pdf As Worksheet
Set dlgFile = Application.FileDialog(msoFileDialogSaveAs)
With dlgFile
.AllowMultiSelect = False
.Title = "Choisir le dossier et le nom du fichier à exprter ..."
nIdxFltr = 0
For Each objFltr In .Filters
nIdxFltr = nIdxFltr + 1
If UCase(objFltr.Extensions) = "*.PDF" Then
.FilterIndex = nIdxFltr
Exit For
End If
Next
.InitialFileName = Range("V_NOM_FICHIER").Value ' si V_NOM_FICHIER n'est pas sur la feuille active précisez la feuille
.Show
If .SelectedItems.Count = 0 Then Exit Sub
cFNomPdf = .SelectedItems.Item(1)
End With
Set wsXls2Pdf = ActiveSheet ' à adapter à une autre feuille si besoin
wsXls2Pdf.ExportAsFixedFormat Type:=xlTypePDF, Filename:=cFNomPdf
End Sub
Le fichier
Cdlt,
Cylfo