Option Explicit
Sub EnregistrerPDF()
Dim Chemin As String, NomFichier As String, madate As String, madate2 As String
Dim Rep As Long
Rep = MsgBox("Exporter en PDF ?" & Chr(13) & "En cliquant sur OK, vous pourrez choisir le dossier de destination." & Chr(10) & Chr(10) & "ATTENTION : le nom du fichier est créé automatiquement.", vbYesNo + vbQuestion)
If Rep = vbYes Then
NomFichier = ActiveDocument.FormFields("nomsite")
madate = Now()
madate2 = Format(madate, "dd-mmmm-yyyy hh-mm")
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = -1 Then
Chemin = .SelectedItems(1)
Else
Exit Sub
End If
End With
ActiveDocument.ExportAsFixedFormat OutputFileName:=Chemin & "\" & NomFichier & " - " & madate2, _
ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, _
OptimizeFor:=wdExportOptimizeForPrint, _
Range:=wdExportAllDocument, _
From:=1, To:=1, _
Item:=wdExportDocumentContent, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
End If
End Sub