Sub PDF()
Dim today As Variant, Nome As String
If Range("C16") = "" Or Range("C18") = "" Or Range("G18") = "" Or Range("G18") = "" Or Range("B22") = "" Then
MsgBox "Non sono presenti tutti i dati per stampare"
Else
ActiveWindow.View = xlNormalView
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
today = Now
today = Cells(13, 4) & "_" & Format(Date, "mm") & "." & Format(Date, "dd") & "." & Format(Date, "yy") & "." & Format(Time, "hhmmss")
Nome = "C:UsersUtente.ASSERVICEDesktopstorico Ritiri"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome & today & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("C16,C18,G16,G18,B22:N3") = "" ' sicuro sino N39
Cells(13, 4) = Cells(13, 4) + 1 ' per aumentare Bordero
MsgBox "PDF creato/salcato"
ActiveWorkbook.Save
ThisWorkbook.Close 'quit non lo uso mai "pericoloso"
End If
End Sub |