VBA rename a printer

Liamfoxtrot

New Member
Joined
Nov 10, 2009
Messages
1
I am looking to use VBA to change the name of a printer. I have USB printers and each one is named the same except the copy number. For example I have PrinterXX and PrinterXX (Copy 1) and PrinterXX (Copy 2). I would like to be able rename these in code. Has anyone done this is VBA before?

Thanks in Advance,
Andy
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
In the absence of another reply .........

Printers are named by the Windows system so you will need to dig a bit to see if Excel can change that. May be possible. Perhaps using an API Function or making a change to the Windows Registry (not such a difficult/terrible thing as many make out).

I have not searched much but here is an API function to investigate :-

Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long


It looks like it is "read only" - but I could be wrong.
Look for other API's with 'print' or 'printer'
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top