ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   excel macro to automatically change default printer (https://www.excelbanter.com/excel-discussion-misc-queries/65250-excel-macro-automatically-change-default-printer.html)

James Bromley

excel macro to automatically change default printer
 
I need a macro to change the default printer to another selected preselected
printer.
I can get a workbook to do this but only after its been opened and then
re-run the macro.
this is to automate a workbook that has to be printed out on one type of
printer only and the users that will have it are not the sharpest biters in
the food chain!!

Norman Jones

excel macro to automatically change default printer
 
Hi James,

Try something like:

'=============
Private Sub Workbook_Activate()
Application.ActivePrinter = "HPPhpoto on LPT1:"
End Sub
'<<=============

'=============
Private Sub Workbook_Deactivate()
Application.ActivePrinter = _
"EPSON Stylus Photo 830U Series on Ne01:"
End Sub
'<<=============

This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module):

Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.

Change the printers so suit your scenario.


---
Regards,
Norman



"James Bromley" <James wrote in message
...
I need a macro to change the default printer to another selected
preselected
printer.
I can get a workbook to do this but only after its been opened and then
re-run the macro.
this is to automate a workbook that has to be printed out on one type of
printer only and the users that will have it are not the sharpest biters
in
the food chain!!





All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com