Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Excel changing Default Printer

Alright, the issue I am having is my macro is changing the Default Printer to
my Color Printer. now the macro is supposed to change to my color printer and
print sheets, which it does, but it is changing my Default Printer for all
programs. Thanks for any help.

Sub Finalize()
'
' Finalize Macro
' Macro recorded 12/22/2004 by Psion Teklogix
'

'
Sheets("Products").Select
Range("C11").Select
ActiveCell.FormulaR1C1 = "N"
Range("C12").Select
Sheets("Agreement").Select
Dim ans As String
ans = InputBox("Please Enter Contract #", "Contract #",
Sheets("Agreement").Cells(8, 12).Value)
If ans = "" Then
Exit Sub
Else
With Worksheets("Agreement")
Cells(8, 12) = (ans)
End With
Application.ScreenUpdating = False
On Error Resume Next
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne02:"
Err.Clear
End If
Sheets("Letter").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("G:\CONTRACT\Contract Terms\macro\2005
t&cscontract.doc")
WD.ActivePrinter = Application.ActivePrinter
WD.ActiveDocument.PrintOut Background:=False
WD.Application.Quit SaveChanges:=wdDoNotSaveChanges
Set WD = Nothing
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ScreenUpdating = True
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Excel changing Default Printer

Before changing the default printer:

Dim oldDefPrinter As String
oldDefPrinter = Application.ActivePrinter

Then change the printer in code.
Take Print Out,

When done do
Application.ActivePrinter = oldDefPrinter

Sharad
"Brad" wrote in message
...
Alright, the issue I am having is my macro is changing the Default Printer
to
my Color Printer. now the macro is supposed to change to my color printer
and
print sheets, which it does, but it is changing my Default Printer for all
programs. Thanks for any help.

Sub Finalize()
'
' Finalize Macro
' Macro recorded 12/22/2004 by Psion Teklogix
'

'
Sheets("Products").Select
Range("C11").Select
ActiveCell.FormulaR1C1 = "N"
Range("C12").Select
Sheets("Agreement").Select
Dim ans As String
ans = InputBox("Please Enter Contract #", "Contract #",
Sheets("Agreement").Cells(8, 12).Value)
If ans = "" Then
Exit Sub
Else
With Worksheets("Agreement")
Cells(8, 12) = (ans)
End With
Application.ScreenUpdating = False
On Error Resume Next
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne02:"
Err.Clear
End If
Sheets("Letter").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("G:\CONTRACT\Contract Terms\macro\2005
t&cscontract.doc")
WD.ActivePrinter = Application.ActivePrinter
WD.ActiveDocument.PrintOut Background:=False
WD.Application.Quit SaveChanges:=wdDoNotSaveChanges
Set WD = Nothing
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ScreenUpdating = True
End If
End Sub



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
members on my network printer not able to print to default printer smeheut Excel Discussion (Misc queries) 0 June 18th 07 06:42 PM
Excel switches back to default printer after a while Shirlo Excel Discussion (Misc queries) 0 May 17th 07 08:05 PM
Save default printer info in Excel JJRamCHS Excel Discussion (Misc queries) 0 April 27th 07 10:54 PM
how do i get excel to default print to fastdraft on my HP Printer Bigtalker Excel Discussion (Misc queries) 0 July 18th 05 10: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 10:36 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"