Sunday, April 1, 2007

Install printer

On Error Resume Next

Dim objNetwork, objPrinter

Set objNetwork = CreateObject("Wscript.Network")

objPrinter=inputbox("Please type the name of the printer: ", "Install Printer", "\\PrinterServer\Printer001")

objNetwork.AddWindowsPrinterConnection objPrinter

'MsgBox err.number

If err.number=70 Then
msgbox "You are not authenticated to the print server. You need to run PrinterServerConnect", 16, "Printer Not Installed"

ElseIf err.number=-2147023095 Then
msgbox "Print queue name is invalid: " & objPrinter, 16, "Printer Not Installed"

ElseIf err.number=0 Then
msgbox "You can select the printer " & objPrinter & " from the print menu", 64, "Printer Installed"

End If

set objNetwork=nothing
set oWshShell=nothing

No comments:

Related Titles

visitors since March 26 2007