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
| Sub factureAimprimer()
Dim w1 As Worksheet
Dim w2 As Worksheet
Dim L As Long
Dim D As Date
Set w1 = Worksheets("Liste")
Set w2 = Worksheets("Facture")
D = Date
Application.ScreenUpdating = False
L = ActiveCell.Row
If MsgBox("Etes-vous certain de vouloir imprimer la facture de la cliente : " & Cells(L, 3), vbYesNo, "Demande de confirmation") = vbYes Then
w2.Range("E4").Value = CDate(w1.Cells(L, 1))
w2.Range("E6").Value = w1.Cells(L, 2)
w2.Range("D8").Value = w1.Cells(L, 3)
w2.Range("B14").Value = w1.Cells(L, 4)
w2.Range("D14").Value = w1.Cells(L, 5)
w2.Range("E32").Value = w1.Cells(L, 6)
w2.PageSetup.PrintArea = ("A1:E32")
w2.PrintOut
w2.PageSetup.PrintArea = ""
End If
w2.Select
'*************************Enregistrement Rapport Format PDF*******************
Dim Ar(0) As String
Ar(0) = Feuil2.Name
Sheets(Ar).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "Facture " & Range("E6") _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
'********************************************************************************
Application.ScreenUpdating = True
End Sub |
Partager