Private Sub CmdExportPDF_Click()
Dim Chemin$, Fiche$, NomFiche$
Dim SheetArray() As Variant
Dim I&, Indx&
Chemin = ThisWorkbook.Path & Application.PathSeparator
Fiche = "TestV2"
Indx = 0
For I = 0 To LbFeuilles.ListCount - 1
If LbFeuilles.Selected(I) Then
ReDim Preserve SheetArray(Indx)
SheetArray(Indx) = LbFeuilles.List(I)
Indx = Indx + 1
End If
Next I
If Indx > 0 Then
Application.ScreenUpdating = False
Sheets(SheetArray()).Select
Sheets(SheetArray()).Unprotect 123 'mettre ton mot de passe
NomFiche = Chemin & Fiche
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PageSetup.Zoom = False
ActiveSheet.PageSetup.FitToPagesTall = 1
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=NomFiche, _
Quality:=xlQualityMinimum, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Sheets(SheetArray()).Protect 123 'mettre ton mot de passe
End If
Erase SheetArray
Feuil1.Select
Unload Me
Application.GoTo [A1], True
End Sub