Solved

Word Template - Tray ID issue

Posted on 2006-06-21
8
569 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
  • 4
8 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now