>>cPrnName = "My Printer Name" >>TRY >> set printer to name (cPrnName) >>CATCH >> =MESSAGEBOX("Printer " + cPrnName + "failed",48,"Test") >>ENDTRY >>>>
>Function printerexist >Lparameters cPrintername >Local nLoop >Local Array aTemp(1) >If Empty(cPrintername) > Return .F. >Endif >If Aprinters(aTemp)<=0 > Return .F. >Endif >For nLoop=1 To Alen(aTemp,1) > If Upper(Alltrim(aTemp[nLoop,1]))==Upper(Alltrim(cPrintername)) > Return .T. > Endif >Endfor >Return .F. >Endfunc >Interesting. I would have used the TRY/CATCH method.