Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dd dd is offline
external usenet poster
 
Posts: 95
Default changing and re-setting the default printer

I'm trying to create a menu item based on a macro to print to PDF. The
problem is that after it has printed the default printer remains PDF. I want
to reset the active printer to 5004

I recorded two macros, one to print to pdf and one to reset the printer but
the part "Ne05 seems to vary every day so that the macro doesn't reset my
default printer to 5004.

Application.ActivePrinter = "PDF995 on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"PDF995 on Ne00:", Collate:=True

Application.ActivePrinter = "\\S1103\A5004 on Ne05:"
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
' "\\S1103\A5004 on Ne05:", Collate:=True

I notice in Word I can simply use:

Application.ActivePrinter = "PDF995" and
Application.ActivePrinter = "A5004"

But Excel doesn't accept this.

Regards
Dylan
Scotland



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default changing and re-setting the default printer

Store the name of the acrtivePrinter before you change it; then reset

dim OldPrinterName as string

OldPrintername =Application.ActivePrinter
'..code
Application.ActivePrinter=OldPrintername

NickHK

"dd" <dd.dd wrote in message
...
I'm trying to create a menu item based on a macro to print to PDF. The
problem is that after it has printed the default printer remains PDF. I

want
to reset the active printer to 5004

I recorded two macros, one to print to pdf and one to reset the printer

but
the part "Ne05 seems to vary every day so that the macro doesn't reset my
default printer to 5004.

Application.ActivePrinter = "PDF995 on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"PDF995 on Ne00:", Collate:=True

Application.ActivePrinter = "\\S1103\A5004 on Ne05:"
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
' "\\S1103\A5004 on Ne05:", Collate:=True

I notice in Word I can simply use:

Application.ActivePrinter = "PDF995" and
Application.ActivePrinter = "A5004"

But Excel doesn't accept this.

Regards
Dylan
Scotland





  #3   Report Post  
Posted to microsoft.public.excel.programming
dd dd is offline
external usenet poster
 
Posts: 95
Default changing and re-setting the default printer

Nick

Thank you for solving this problem for me.

Kind regards
Dylan

"NickHK" wrote in message
...
Store the name of the acrtivePrinter before you change it; then reset

dim OldPrinterName as string

OldPrintername =Application.ActivePrinter
'..code
Application.ActivePrinter=OldPrintername

NickHK

"dd" <dd.dd wrote in message
...
I'm trying to create a menu item based on a macro to print to PDF. The
problem is that after it has printed the default printer remains PDF. I

want
to reset the active printer to 5004

I recorded two macros, one to print to pdf and one to reset the printer

but
the part "Ne05 seems to vary every day so that the macro doesn't reset my
default printer to 5004.

Application.ActivePrinter = "PDF995 on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"PDF995 on Ne00:", Collate:=True

Application.ActivePrinter = "\\S1103\A5004 on Ne05:"
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
' "\\S1103\A5004 on Ne05:", Collate:=True

I notice in Word I can simply use:

Application.ActivePrinter = "PDF995" and
Application.ActivePrinter = "A5004"

But Excel doesn't accept this.

Regards
Dylan
Scotland






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
setting the default printer for this workbook only mikecoxffbb Excel Worksheet Functions 1 October 25th 08 01:47 AM
Default printer setting John Excel Discussion (Misc queries) 1 March 22nd 07 03:20 PM
Setting default printer using wsh PO Excel Programming 3 February 14th 05 07:09 PM
Excel changing Default Printer Brad Excel Programming 1 January 7th 05 04:02 PM
Changing the default printer... Meek Spiffinton Excel Programming 1 November 29th 04 05:21 PM


All times are GMT +1. The time now is 07:51 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"