Thread: error control
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Graeme[_3_] Graeme[_3_] is offline
external usenet poster
 
Posts: 4
Default error control

I have just written my first VBScript/Macro that does
some cool manipulation of data. How do I get the script
to exit gracefully if something is wrong, or out of place?

For example:

I have a button attached to this script for printing:

Application.ActivePrinter = "Acrobat PDFWriter on
LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
ActivePrinter:= _
"Acrobat PDFWriter on LPT1:"



If I hit cancel in the print screen the script will stop
and go into debug. Is there a generic script "If error
then....."

Thanks for the helping,
Graeme