Solved

Word Template - Tray ID issue

Posted on 2006-06-21
8
581 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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