Bonjour a tous

Je souhaite avoir une Userforme pour pouvoir imprimer mes feuilles excel .
=> j'aimerais ajouter un bouton pour pouvoir imprimer tous mes onglets et pouvoir exclure Quelques feuilles comme accueil par exemple .


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Option Explicit
'Déclaration
Sub SelectSheets()
    Dim I As Integer
    Dim TopPos As Integer
    Dim SheetCount As Integer
    Dim PrintDlg As DialogSheet
    Dim CurrentSheet As Worksheet
    Dim cb As CheckBox
    Application.ScreenUpdating = False
 
'   regarder si le classeur est protégé
    If ActiveWorkbook.ProtectStructure Then
        MsgBox "Le classeur est protégé.", vbCritical
        Exit Sub
    End If
 
'   ajouter dialog sheet tempo
    Set CurrentSheet = ActiveSheet
    Set PrintDlg = ActiveWorkbook.DialogSheets.Add
 
    SheetCount = 0
 
'   ajouter les checkboxes
 
    TopPos = 40
    For I = 1 To ActiveWorkbook.Worksheets.Count
        Set CurrentSheet = ActiveWorkbook.Worksheets(I)
'       Sauter les Sop vide et sop caché
        If Application.CountA(CurrentSheet.Cells) <> 0 And _
            CurrentSheet.Visible Then
            SheetCount = SheetCount + 1
            PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
                PrintDlg.CheckBoxes(SheetCount).Text = _
                    CurrentSheet.Name
            TopPos = TopPos + 13
        End If
    Next I
 
'   Bouger le ok et le cancel
    PrintDlg.Buttons.Left = 240
 
'   Set dialog height, width, and caption
    With PrintDlg.DialogFrame
        .Height = Application.Max _
            (68, PrintDlg.DialogFrame.Top + TopPos - 34)
        .Width = 230
        .Caption = "Cochez les feuilles à imprimer."
 
    End With
 
'   Change tab order of OK and Cancel buttons
'   so the 1st option button will have the focus
    PrintDlg.Buttons("Button 2").BringToFront
    PrintDlg.Buttons("Button 3").BringToFront
 
'   Display the dialog box
    CurrentSheet.Activate
    Application.ScreenUpdating = True
    If SheetCount <> 0 Then
        If PrintDlg.Show Then
            For Each cb In PrintDlg.CheckBoxes
                If cb.Value = xlOn Then
                    Worksheets(cb.Caption).Activate
                    ActiveSheet.PrintOut
'                   ActiveSheet.PrintPreview 'for debugging
 
                End If
            Next cb
        End If
    Else
        MsgBox "Toutes les feuilles sont vides."
    End If
 
'   Delete temporary dialog sheet (without a warning)
    Application.DisplayAlerts = True
    PrintDlg.Delete
 
'   Reactivate original sheet
    CurrentSheet.Activate
End Sub
Merci beaucoup