frmAbortTest Print Cancel Demo Form1% cmdAbortTest Exit Test cmdAbortTest Abort Print Job cmdAbortTest Start Print Job Command1_Click NoPrintMan EndIt dummyy Command2_Click Printer Command1 VisibleW Form_Click Command2 @ Form_LoadH EndPrn Caption form1A WaitTime0 defineu AbortDoc junkX ErrorHandler ErrorHandleer+ AbortJob Functions exampleP display messages associated numbers this] paste% Declarations section press click UserError PrintCancel Command3_Click cmdAbortTest_Click Index LineNo cmdAbortTest Form_Paint Screen Width Height frmAbortTest PageNo> cmdAbortTest_Click Start Print Job Set Shared AbortJob to false, it will bel reset to true if Abort Job is selected by user. Set up a small delay so user can see what is happening to print job Inform the user of what's happening Printing Page: Line: Give user a chance to do somethings Print Job Complete Abort Print Job Set up a local error handler to handle the error we are going to cause shortly. Call Windows' AbortDoc function in the GDI libary VB's printer object doesn't know you have aborted the print job, so when a Printer.EndDoc is issued VB is going to give you a printer error. Issue the EndDoc now while you can ignore the error.. Print Job Aborted AbortJob = True Exit Test Exit the sub here so that you don't run into your error handling routine. Error handler for VB's printer error. This is VB's printer error so ignore it!x If it's not the printer error then inform the user of the error and end program execution Form_Load Put form in the middle of the screen Let'em know what program they are running Abort Print Job Test Form_Paint