I’m installing a network printers using vbscript and I want to show a friendly error if the queue doesn’t exist or the printer server is unavailable, can I do this with VBScript? My code is below.
Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\printsrv\HPLaser23"
net.SetDefaultPrinter "\\printsrv\HPLaser23"
Many thanks for the help
Steven
Add the line:
Before your code
and then do an:
After your code
It’s normally best to try to keep the number of lines of code between the
On Error Resume Nextand theOn Error GoTo 0to as few as possible, since it’s seldom good to ignore errors.