Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Do not print if error
Hi
I have the following code which saves an invoice to my hd and then prints it. Is it possible for the macro to stop if the invoice already exists on my hard disk? Sub MetroparkPrint() ' MetroParkPrint Macro ' Macro to save and then print an invoice ActiveWorkbook.SaveAs ("c:\Metropark\" & Range("j10") & ".xls") With ActiveSheet.PageSetup .Orientation = xlLandscape .Zoom = 80 .PrintErrors = xlPrintErrorsDisplayed End With ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub Thanks Edgar |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Do not print if error
Sub MetroparkPrint()
Dim sName as String ' MetroParkPrint Macro ' Macro to save and then print an invoice sName = "c:\Metropark\" & Range("J10") & ".xls" if dir(sName) < "" then exit sub ActiveWorkbook.SaveAs sName With ActiveSheet.PageSetup .Orientation = xlLandscape .Zoom = 80 .PrintErrors = xlPrintErrorsDisplayed End With ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub -- Regards, Tom Ogilvy "Edgar" wrote in message ... Hi I have the following code which saves an invoice to my hd and then prints it. Is it possible for the macro to stop if the invoice already exists on my hard disk? Sub MetroparkPrint() ' MetroParkPrint Macro ' Macro to save and then print an invoice ActiveWorkbook.SaveAs ("c:\Metropark\" & Range("j10") & ".xls") With ActiveSheet.PageSetup .Orientation = xlLandscape .Zoom = 80 .PrintErrors = xlPrintErrorsDisplayed End With ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub Thanks Edgar |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error created when try to Print Preview or Print | Excel Discussion (Misc queries) | |||
Print Error Message: Print titles must be contiguous and complete | Excel Discussion (Misc queries) | |||
Excel spreadsheet print preview error "nothing to print" | Excel Discussion (Misc queries) | |||
Why do I get a print error light trying to print an excel sheet ? | Excel Discussion (Misc queries) | |||
print error | Excel Discussion (Misc queries) |