Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
Excel switches back to default printer after a while | Excel Discussion (Misc queries) | |||
Save default printer info in Excel | Excel Discussion (Misc queries) | |||
how do i get excel to default print to fastdraft on my HP Printer | Excel Discussion (Misc queries) | |||
Changing the default printer... | Excel Programming |