Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi...
I know that I can change the printer with: Application.Activeprinter="HPPhpoto on LPT1:" Is there any way of checking the existance of the printer before using the Activeprinter change? I just want to be sure the printer exist before I create an error if it doesn't... because I'm dealing with over 100 printers! Craig |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Craig,
Can't you just trap the error ? NickHK "Craig" wrote in message news:gYaUe.450089$5V4.294592@pd7tw3no... Hi... I know that I can change the printer with: Application.Activeprinter="HPPhpoto on LPT1:" Is there any way of checking the existance of the printer before using the Activeprinter change? I just want to be sure the printer exist before I create an error if it doesn't... because I'm dealing with over 100 printers! Craig |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Craig
Try it and see if it errs, if so, reset to previous, if not, ok. Like this: Sub test() If PrinterOK("HPPhpoto on LPT1:") Then MsgBox "OK" Else MsgBox "Not cool" End If End Sub Function PrinterOK(sPrinterName As String) As Boolean Dim sCurrPrinter As String sCurrPrinter = Application.ActivePrinter On Error Resume Next Application.ActivePrinter = sPrinterName DoEvents If Err.Number < 0 Then Application.ActivePrinter = sCurrPrinter DoEvents PrinterOK = False Else PrinterOK = True End If End Function HTH. Best wishes Harald "Craig" skrev i melding news:gYaUe.450089$5V4.294592@pd7tw3no... Hi... I know that I can change the printer with: Application.Activeprinter="HPPhpoto on LPT1:" Is there any way of checking the existance of the printer before using the Activeprinter change? I just want to be sure the printer exist before I create an error if it doesn't... because I'm dealing with over 100 printers! Craig |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Harald... worked like a charm!
Craig "Harald Staff" wrote in message ... Hi Craig Try it and see if it errs, if so, reset to previous, if not, ok. Like this: Sub test() If PrinterOK("HPPhpoto on LPT1:") Then MsgBox "OK" Else MsgBox "Not cool" End If End Sub Function PrinterOK(sPrinterName As String) As Boolean Dim sCurrPrinter As String sCurrPrinter = Application.ActivePrinter On Error Resume Next Application.ActivePrinter = sPrinterName DoEvents If Err.Number < 0 Then Application.ActivePrinter = sCurrPrinter DoEvents PrinterOK = False Else PrinterOK = True End If End Function HTH. Best wishes Harald "Craig" skrev i melding news:gYaUe.450089$5V4.294592@pd7tw3no... Hi... I know that I can change the printer with: Application.Activeprinter="HPPhpoto on LPT1:" Is there any way of checking the existance of the printer before using the Activeprinter change? I just want to be sure the printer exist before I create an error if it doesn't... because I'm dealing with over 100 printers! Craig |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Look up a value from a row after verifying two other values | Excel Worksheet Functions | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
Printer Multiple Worksheets with a particular Printer Setting | Excel Worksheet Functions | |||
Verifying value of a cell | Excel Discussion (Misc queries) | |||
Verifying Dates | Excel Worksheet Functions |