#1   Report Post  
Posted to microsoft.public.excel.misc
Stephen C
 
Posts: n/a
Default Macro printing

I am trying to set up a print macro which automatically print to a
pre-selected printer and not the one set as default on the computer.

The default printer needs to be set back to the one it was on for that user.

I have come up with the following code for doing this but when another user
tries to print it comes up with an error, I have worked out that it is the
Ne02 ref, on there computer it is Ne03.

The Ne ref seems to be the number that the computer give the network printer
in order they are installed on the computer, unfortunately if you were to
delete a printer and restart your computer these ref update and may change.

All I am after is a piece of code that will search for the Ne number for the
HP Laserjet 2100 PCL6 printer (To replace Ne02).


Dim STDprinter As String
STDprinter = Application.ActivePrinter
Application.ActivePrinter = "HP LaserJet 2100 PCL6 on Ne02:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1

Application.ActivePrinter = STDprinter



Any help will be appreciated

Stephen

  #2   Report Post  
Posted to microsoft.public.excel.misc
JWM6
 
Posts: n/a
Default Macro printing


Apparently VBA doesn't allow you to iterate/enumerate through the
available printers. See this link...

http://word.mvps.org/FAQs/MacrosVBA/...lePrinters.htm


--
JWM6
------------------------------------------------------------------------
JWM6's Profile: http://www.excelforum.com/member.php...o&userid=33413
View this thread: http://www.excelforum.com/showthread...hreadid=532262

  #3   Report Post  
Posted to microsoft.public.excel.misc
JWM6
 
Posts: n/a
Default Macro printing


then I find this....

Try:
'It saves the current printer name, prompts you to select an installed
'Printer, Prints and then restores the old printer.

strOldActivePrinter = Application.ActivePrinter
Application.Dialogs(9).Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOldActivePrinter


Also you can get the new printer that was selected through these calls

Application.Dialogs(9).Show
newPrinter = Application.ActivePrinter


--
JWM6
------------------------------------------------------------------------
JWM6's Profile: http://www.excelforum.com/member.php...o&userid=33413
View this thread: http://www.excelforum.com/showthread...hreadid=532262

  #4   Report Post  
Posted to microsoft.public.excel.misc
Stephen C
 
Posts: n/a
Default Macro printing

Thanks for the reply but i was trying to find a way to automatically select a
printer and print without the user having any input.

"JWM6" wrote:


then I find this....

Try:
'It saves the current printer name, prompts you to select an installed
'Printer, Prints and then restores the old printer.

strOldActivePrinter = Application.ActivePrinter
Application.Dialogs(9).Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOldActivePrinter


Also you can get the new printer that was selected through these calls

Application.Dialogs(9).Show
newPrinter = Application.ActivePrinter


--
JWM6
------------------------------------------------------------------------
JWM6's Profile: http://www.excelforum.com/member.php...o&userid=33413
View this thread: http://www.excelforum.com/showthread...hreadid=532262


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Need assistance with printing macro Greegan Excel Worksheet Functions 0 September 7th 05 05:29 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"