ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing Problems (https://www.excelbanter.com/excel-programming/320196-printing-problems.html)

Brad

Printing Problems
 
Hello,

I have 6 users who print out a contract from Excel. This is using our color
printer (HP Color LaserJet P_30), which I can get to work with no problem.
The problem I am running into, is my macro that prints this contract opens a
word document and prints that as well. The issue is, some of my users print
on "HP Color LaserJet P_30 on ne01" and some print on "HP Color LaserJet P_30
on ne02". How can I make the word doc print to this color printer . My code
is below. Any help is appreciated.

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

'

Sheets("Agreement").Cells(8, 12).Value = InputBox("Please Enter Contract
#", "Contract #", Sheets("Agreement").Cells(8, 12).Value)
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
Application.ScreenUpdating = False
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 = "HP Color LaserJet P_30:"
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 Sub


Brad

Printing Problems
 
I resolved it.

WD.ActivePrinter = Application.ActivePrinter


"Brad" wrote:

Hello,

I have 6 users who print out a contract from Excel. This is using our color
printer (HP Color LaserJet P_30), which I can get to work with no problem.
The problem I am running into, is my macro that prints this contract opens a
word document and prints that as well. The issue is, some of my users print
on "HP Color LaserJet P_30 on ne01" and some print on "HP Color LaserJet P_30
on ne02". How can I make the word doc print to this color printer . My code
is below. Any help is appreciated.

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

'

Sheets("Agreement").Cells(8, 12).Value = InputBox("Please Enter Contract
#", "Contract #", Sheets("Agreement").Cells(8, 12).Value)
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
Application.ScreenUpdating = False
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 = "HP Color LaserJet P_30:"
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 Sub



All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com