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 82 83 84 85 86 87
| Option Explicit
Sub Creation_fiche_PDF()
' Copie selection ver le tableau de génération fiche
Sheets("Saisie Article").Select
Call CREATION_DOSSIER
Range("Tableau2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Tableau articles").Activate
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
ActiveSheet.ListObjects("Tableau1").AutoFilter.ApplyFilter
With ActiveWorkbook.Worksheets("Tableau articles").ListObjects("Tableau1").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("Saisie Article").Select
' Définition des variables dans lesquelles seront sotcké les valeurs du tableau
Dim Nom, demandeur, secteur, a, b, c, d, e, f, g, As String
Dim Ligne_debut, Ligne_fin As Integer
Dim i As Integer
Ligne_debut = Range("A4").Value
Ligne_fin = Range("B4").Value
' Boucle incrémentale de création des articles
For i = Ligne_debut To Ligne_fin
Dim j As Integer
j = i - 1
..../......
Dim LeNom As String, LeRep As String
LeNom = Range("S1").Value
LeRep = ThisWorkbook.Path & "\" ' chemin de la fiche article PDF dans sous-dossier
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
LeRep & LeNom & "\" & LeNom & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
From:=1, To:=1, OpenAfterPublish:=False
Dim Pdf As Object, Fichiers(2)
Set Pdf = CreateObject("pdfforge.pdf.pdf")
Fichiers(0) = ThisWorkbook.Path & LeNom & "\" & LeNom & ".pdf"
Fichiers(1) = ThisWorkbook.Path & LeNom & "\" & "Devis.pdf"
Fichiers(2) = ThisWorkbook.Path & LeNom & "\" & "Fiche technique.pdf"
Pdf.MergePDFFiles_2 Fichiers, ThisWorkbook.Path & "\" & LeNom & ".pdf", True
Set Pdf = Nothing
ActiveWorkbook.Close False
Sheets(1).Select
Next
Sheets("Fiche de création").Visible = False
Sheets("Saisie Article").Select
Range("B2").Select
MsgBox "Fiche créée en PDF avec succès"
End Sub |
Partager