Programatically rename a printer

greaseman

Closer to seniority!
Local time
Today, 06:56
Joined
Jan 6, 2003
Messages
360
I've got a piece of code that adds a printer at a certain point in my VBA code:

'********************************************************
Option Compare Database
Option Explicit

Public Function AddAPrinter()
Dim WshNetwork As Object
Dim PrinterPath As String
Dim PrinterDriver As String

Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\network.name\NSM13A7"
PrinterDriver = "Lexmark Color 4079 plus PS"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver

End Function
'*******************************************************

My question is: I then want to, using code, rename the printer, to something nicer than (in my example) "NSM13A7." I'd like something simple like "Printer." Does anyone have a suggestion on how I might accomplish this?
 

Users who are viewing this thread

Back
Top Bottom