Solved

Word Template - Tray ID issue

Posted on 2006-06-21
8
589 Views
Last Modified: 2012-08-14

I have two type of printers in my company. HP4300TN and HP4350TN.

We have a number of word 2000 templates which work fine with the 4300TN, whereby when a user prints it automatically defaults to letterhead paper as specified in the paper source tab in the page setup.

My problem occurs when my default printer is set to the 4350TN printer. The word template changes the paper source to Light 60-75 g/m2.  So when the user prints, the printer freaks out as it cannot find the Light Tray as the tray is configured to letterhead.

After doing some research I found out that the problem lies in the tray ID. On the HP 4300 the letterhead paper type is set to id: 1265 and on the 4350 the light paper has the same id of: 1265. So when you change printers from 4300 to 4350 the word template changes the paper source from letterhead to light and vice versa.

How can I resolve this issue? Is it possible to add a VBA script to the template saying:
If your printer is a 4300 change the paper source to letterhead or tray id:1265
If you printer is a 4350 change the paper source to letterhead or tray id:1271 (NOT 1265, which is what it is doing now)

Anyone can help.

Thanks
0
Comment
Question by:Priscilla_Hora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
8 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 16958233
You can change the printer trays with a macro like this. You need to change both first and other pages tray.

The main problem is when to run this. Most situations would be covered if call it from the Document_Open and Document_New events in ths ThisDocument module of your template. However if you are likely to change printers after that has happened, it might get a bit more complicated.

Sub PrinterTrays()
Dim strPrinterName As String

strPrinterName = Application.ActivePrinter
With ActiveDocument.PageSetup
    If InStr(1, strPrinterName, "HP4300TN", vbTextCompare) Then
        .FirstPageTray = 1265
        .OtherPagesTray = 1265
    Else
    'next line not needed if there are only two printer types
    'If InStr(1, strPrinterName, "HP4350TN", vbTextCompare) Then '
        .FirstPageTray = 1271
        .OtherPagesTray = 1271
    'End If
    End With
End Sub
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16958284
Your next question here:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21895174.html
looks like the same question, but worded differently.

As far as I can see the, the answer would be the same as for this one.
You are not allowed to offer more than 500 points for the same question. However you while it has no comments you would be able to delete it yourself.

If you think it's essentially a different question, perhaps you could add a comment explaining the differnce that so that an expert can address that different question.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16958330
Hmm, it seems that you have also posted this question in the Word area:
http://www.experts-exchange.com/Applications/MS_Office/Word/Q_21895137.html

and that gBhari has given a similar answer.

I think we'll have to wait and see if the moderators come across it and let them sort it out.
0
 

Author Comment

by:Priscilla_Hora
ID: 16964746
Where would I put the code in so that it automatically checks which printer is connected upon opening the template?
I don't want this to be a button where a user clicks on, this process has to be invisible to the user.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16966623
Put these calls in the ThisDocument Module of your template:

Private Sub Document_New()
    PrinterTrays
End Sub

Private Sub Document_Open()
    PrinterTrays
End Sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question