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 |
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 |
All times are GMT +1. The time now is 08:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com