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 28 29 30 31 32 33 34 35 36
|
periode = Range("O2").Value 'la cellule O2 précise le mode de synthèse : trimestre ou semestre
fichier = ActiveWorkbook.Path & "\conseils_de_classe_" & periode & "_" & Jour & "-" & Mois & "-" & an & ".pdf"
If Dir(fichier) <> "" Then
If MsgBox("Le fichier " & "conseils_de_classe_" & Cells(2, 15).Value & "_" & Jour & "-" & Mois & "-" & an & ".pdf" & "existe déjà : voulez vous l'écraser?", vbYesNo + vbExclamation + vbDefaultButton2, "Fichier déjà existant !") = vbYes Then
Worksheets("COPY").Range("A1:I71").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=fichier, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Else
nom_fichier = InputBox("Quel nom voulez vous donner à ce fichier ?")
If nom_fichier = "" Then
Call erase_copy
Exit Sub
Else
Worksheets("COPY").Range("A1:I71").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & nom_fichier, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End If
End If
Else
Sheets("COPY").Range("A1:I71").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=fichier, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End If |
Partager