Sub nouvelleFacture()
Dim nom, chemin As Variant
Dim plage As Range
With frmFacture
.Copy
nom = .Range("B17").Value & " - " & .Range("E2").Value & ".Pdf"
Select Case (.Range("D8"))
Case Is = "FACTURE": chemin = "D:\savePDF" & "\Facture\"
Case Else: chemin = "D:\savePDF" & "\Devis\"
End Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
chemin & nom, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
MsgBox "Votre sauvegarde porte la référence : " & " " & nom
.Range("A19:E33,E2:E4,E5,G5,G12,D19:D33,A41").Value = ""
End With
'Sauvegarde les modifications
ActiveWorkbook.Save
ActiveWindow.Close
Call Ajouternum
End Sub
Sub Ajouternum()
'Incrémentation N° Facture
Dim c As Long
Application.ScreenUpdating = False
With frmFacture
c = .Range("L5").Value
'.Range("L5").Value = c + 1
If .Range("D8").Value = "FACTURE" Then
.Range("L5") = c + 1
ElseIf .Range("D8").Value = "DEVIS" Then
.Range("L6") = c + 1
End If
End With
End Sub