1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Option Explicit
Sub Enregistrer_pdf_original()
Dim Rep As Long, Rep2 As Long, sFichier As String
Dim FSO As Object
Rep = MsgBox("Voulez-vous sauvegarder en pdf ?", vbYesNo)
If Rep = vbYes Then
Set FSO = CreateObject("Scripting.FileSystemObject")
sFichier = ThisWorkbook.Path & "\" & FSO.GetBaseName(ThisWorkbook.Name) & ".pdf"
If FSO.FileExists(sFichier) Then
Rep2 = MsgBox("Le fichier pdf existe déjà, confirmer son écrasement ?", vbYesNo)
If Rep2 = vbYes Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFichier, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Else
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFichier, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Set FSO = Nothing
End If
End Sub |
Partager