Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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

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
Problems printing thelos New Users to Excel 1 February 7th 06 09:57 PM
printing problems Big Buck 31 Excel Worksheet Functions 1 September 12th 05 04:41 PM
Help with printing problems? C. P. Excel Discussion (Misc queries) 3 February 22nd 05 02:55 AM
Printing Problems Subs Excel Programming 1 November 27th 04 01:52 PM
Printing problems William Maka Excel Programming 0 February 4th 04 06:29 PM


All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"