Exporter reçus en pdf combinés et dispersés.besoin d 'aide

Bonsoir Forum,

j'ai réussi à insérer un le code pour imprimer les reçus en pdf combinés et dispersés

le problème dans la mise en page au niveau combinés apparaitre décalé et des nombres apparaissent

svp comment corriger ce défaut?

au niveau dispersé

comment rendre le code plus rapide et est ce que possible rendre le code imprime avec la fonction 12 reçus en 1 seul feuille

voici le code:

Option Explicit

Sub imprimer_pdf()
If Not ActiveSheet.Name Like "R*" Then Exit Sub 'sécurité
Dim chemin$, rep As Byte, a$, h&, i&
chemin = ThisWorkbook.Path & "\Reçus\"
If Dir(chemin, vbDirectory) = "" Then MkDir chemin 'création du dossier

        MsgBox "le dossier de sauvegarde a été crée"

rep = MsgBox("Tu veux tous dans un seul fichier pdf?", 3)
If rep = 2 Then Exit Sub
Application.ScreenUpdating = False
With ActiveSheet
    .PageSetup.Zoom = False
    .PageSetup.FitToPagesTall = 1 '1 page en hauteur, détermine le zoom
    If rep = 6 Then 'Oui
        a = .PageSetup.PrintArea
        h = .Range(a).Rows.Count
        .Copy 'nouveau document
        With ActiveSheet
            .PageSetup.PrintArea = ""
            For i = 1 To Val(.[w2] - 1)
                .Range(a).EntireRow.Offset(h * i - h).Copy .[A2].Offset(h * i)
                .[j10].Offset(h * i) = i + 1
                .HPageBreaks.Add Before:=.[A2].Offset(h * i) 'saut de page
            Next
            .PageSetup.PrintArea = .Range(a).Resize(h * i).Address
            .PageSetup.FitToPagesTall = i
            .ExportAsFixedFormat xlTypePDF, chemin & "Groupé.pdf"
            .Parent.Close False 'fermeture du document
        End With
        MsgBox "tous dans un seul fichier pdf"
    Else 'Non
        For i = 1 To Val(.[w2])
            .[j10] = i
            .ExportAsFixedFormat xlTypePDF, chemin & .[j10] & ".pdf"
        Next
        .[j10] = 1
        MsgBox i - 1 & " Nombre de reçu"
    End If
End With
End Sub

Merci d ' avance

5p1.xlsm (109.40 Ko)
Rechercher des sujets similaires à "exporter recus pdf combines disperses besoin aide"