Printer Objects 
Author Message
 Printer Objects

I have a VB 6.0 (sp5) program that I inherited from a
programmer that is no longer here. I am trying to update
the code as well as maintain what is already written.

I have an issue with a print job that is executed from
within the program. There is a default printer defined on
the computer. It prints fine if the network is accessible.
However, when the network goes down and I try to print, I
receive the error message 482 telling me that the printer
isn't accessible and the application exits.

Is there a way for me trap the error with the printer
object when this error occurs to give a message and NOT
exit the application?

If you need additional information, please let me know.

Thanks!
Teresa



Wed, 19 Jan 2005 05:58:57 GMT  
 Printer Objects
At the beginning of the routine that runs when you click "Print"
insert the line "On Local Error Goto TrapPrinterError".  At the end of
the code block for that routine, put in the following lines:

'------------------------
JustEndThisCode:
Exit Sub  'or Exit Function if this code is inside a function, not a
Subroutine.

TrapPrinterError:
x% = MessageBox("There was a printing error.", 0) 'Put in any message
you want.
'If you need to close files or anything, do that here.
Resume JustEndThisCode
'------------------------

Quote:

> I have a VB 6.0 (sp5) program that I inherited from a
> programmer that is no longer here. I am trying to update
> the code as well as maintain what is already written.

> I have an issue with a print job that is executed from
> within the program. There is a default printer defined on
> the computer. It prints fine if the network is accessible.
> However, when the network goes down and I try to print, I
> receive the error message 482 telling me that the printer
> isn't accessible and the application exits.

> Is there a way for me trap the error with the printer
> object when this error occurs to give a message and NOT
> exit the application?

> If you need additional information, please let me know.

> Thanks!
> Teresa



Thu, 20 Jan 2005 20:01:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printer Object - Getting the available printer information

2. VBA: Printer Object / Printer Collection

3. Printer object and printer fonts

4. bug sending text to printer via printer object

5. Printer object can't print to network printer

6. Printer Object and Network Printers - VB3

7. Controlin printer margins when using the Printer.Object

8. printer object and printer margins

9. Printer Object and HP Deskjet Printers

10. Printer- and Printers-Object

11. Printer object / Fax Printer Driver

12. Printer object / Fax Printer Driver

 

 
Powered by phpBB® Forum Software