Bonjour tous le monde,
Je vous remercie d'avoir suivi ce sujet, je suis arrivé à faire les modifs
pour mettre en page ma feuille copiée.
Je vous fais part des codes pour ceux qui sont succeptible d'être intéressés.
Bonne continuation à tous Gix.
[Sub DocuementValider()
Dim vNbreImp As Variant
Dim DocFch As Variant
Dim DocChm As Variant
DocFch = Range('DocFch')
DocChm = Range('DocChm')
If Range('DocNumDoc') = '' Then
informer = MsgBox('Numero Facture obligatoire !', vbOKOnly, 'Ajout impossible / FactureGix')
Range('DocNumDoc').Select
Exit Sub
End If
If Range('RvNomClient') = '' Then
informer = MsgBox('Nom du Client obligatoire !', vbOKOnly, 'Ajout impossible / FactureGix')
Range('RvNomClient').Select
Exit Sub
End If
vNbreImp = InputBox('Nombre d'exemplaire à imprimer :', 'Impression Document / FactureGix', 1)
If vNbreImp <= 0 Then GoTo 5
If IsNumeric(vNbreImp) Then
GoTo 10
Else: Do Until IsNumeric(vNbreImp)
5
MsgBox 'La valeur doit être un nombre entier et > 0'
vNbreImp = InputBox('Nombre d'exemplaire à imprimer :', 'Impression Document / FactureGix', 1)
Loop
GoTo 10
End If
10
Sheets('Facture').Select
ActiveWindow.SelectedSheets.PrintOut Copies:=vNbreImp
If Range('DossierOptCopieDoc') = 'Non' Then GoTo 20
If Range('DossierOptCopieDoc') = 'Oui' Then
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=DocChm, _
FileFormat:=xlNormal, Password:='', WriteResPassword:='', _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows('FactureGix.xls').Activate
Sheets('Facture').Select
Cells.Select
Selection.Copy
Windows(DocFch).Activate
Cells.Select
Selection.PasteSpecial Paste:=xlValues, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range('a1').Select
Application.CutCopyMode = False
With ActiveSheet.PageSetup
.PrintTitleRows = ''
.PrintTitleColumns = ''
End With
ActiveSheet.PageSetup.PrintArea = '$A$1:$K$79'
With ActiveSheet.PageSetup
.LeftHeader = ''
.CenterHeader = ''
.RightHeader = ''
.LeftFooter = ''
.CenterFooter = ''
.RightFooter = ''
.LeftMargin = Application.InchesToPoints(0.15748031496063)
.RightMargin = Application.InchesToPoints(0.118110236220472)
.TopMargin = Application.InchesToPoints(0.118110236220472)
.BottomMargin = Application.InchesToPoints(0.196850393700787)
.HeaderMargin = Application.InchesToPoints(0.118110236220472)
.FooterMargin = Application.InchesToPoints(0.196850393700787)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
ActiveWorkbook.Save
ActiveWorkbook.Close
GoTo 20
End If
20
Windows('FactureGix.xls').Activate
Sheets('Document').Unprotect Password:='gix'
Range('DossierNumDoc') = Range('DossierNumDoc') + 1
Sheets('Document').Select
Range('DocNumDoc') = Range('DossierNumDoc')
Range('RefDocSaisie').Select
Selection.ClearContents
Range('b13').Select
Sheets('Document').Protect Password:='gix'
ActiveWorkbook.Save
End Sub]