niyrho
07-24-2008, 01:24 PM
I got this code on here:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
On Error Goto Exits
Cancel = True
Application.EnableEvents = False
With ActiveSheet
ActiveWorkbook.SaveCopyAs "C:\Work Orders\" & .Range("A1") & Format(.Range("A2"), " yy-mm-dd") & ".xls"
.PrintOut
.Range("A1:A2").ClearContents
End With
Exits:
Application.EnableEvents = True
End Sub
I got two problems. This code isn't working at all now, I think I might be entering it wrong. And I need it to only print up to the first page that isn't filled out.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
On Error Goto Exits
Cancel = True
Application.EnableEvents = False
With ActiveSheet
ActiveWorkbook.SaveCopyAs "C:\Work Orders\" & .Range("A1") & Format(.Range("A2"), " yy-mm-dd") & ".xls"
.PrintOut
.Range("A1:A2").ClearContents
End With
Exits:
Application.EnableEvents = True
End Sub
I got two problems. This code isn't working at all now, I think I might be entering it wrong. And I need it to only print up to the first page that isn't filled out.