Defining which printer to be used

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,644
Office Version
  1. 365
Platform
  1. Windows
Is it possible to allow a user to select the printer on which they want somethign priting to using code?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
To show the print dialog box use:
Code:
Application.Dialogs(xlDialogPrint).Show

If you know the specific printer that should be used, you can change the active printer to that one, print the document and then change the printer back to default by using:
Code:
'set printer to 4015
Application.ActivePrinter = "\\network\LASERJET_4015 on Ne09:"

'print document
ActiveWindow.SelectedSheets.PrintOut Copies:=1

'reset printer to PCL5
Application.ActivePrinter = "\\network\LaserJet_4250 on Ne07:"

Just change the first and last lines to your actual printers (record a macro where you print the document if you don't know the network paths).
 
Upvote 0
Is it possible to inform the user if the printer they have selected has colour print capability?
 
Upvote 0
Thanks Andrew but this code seems to relate to Word VBA and not sure what I need to change other than the un recognised expression, but then I don't know what to change to....
 
Upvote 0
I was wondering if using
Code:
Application.Dialogs(xlDialogPrinterSetup).Show
would allow me to define the printer as an object and then access its properties?
 
Upvote 0
Thanks Andrew but this code seems to relate to Word VBA and not sure what I need to change other than the un recognised expression, but then I don't know what to change to....

The code uses the Windows API, so it's not applicable only to Word.
 
Upvote 0
in the code example; Application.ActivePrinter = \\network\LASERJET_4015 on Ne09:

I am working with a button to allow printing of a workbook. Everything has been going along fine for the past several months. This morning it would not work and told me I had an invalid printer.
After re-recording the macro I found that the printer had changed from Ne04 to Ne05.
Is there anyway to determine this value prior to printing so that I can set the parameter correctly in the macro without having to re-record?

Thanks.:confused:
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,671
Members
452,937
Latest member
Bhg1984

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