Recognizing Printer

N

Noella

Hello
We have different HP printers throughout the firm and I need to write a
macro that will print a 5 page letter. First page to go from tray 3 and
subsequent pages from tray 2. Unfortunately, not all tray numbers are they
same, they range from 257 through to 260. Can I use an IF statement, to say:

If Active Printer = HP4350 Then
blah blah,
Else If ActivePrinter = HP4300 Then
blah blah
End If

Or does Word not recognize the printers?

Any help with this would be greatly appreciated.

Many thanks.
 
S

Steve Yandl

Word recognizes the printers.

Sub TestPrinterActive()
If InStr(Application.ActivePrinter, "HP4350") > 0 Then
MsgBox "Bingo"
Else
MsgBox "Oops"
End If
End Sub

You can use a bunch of ElseIf lines as you suggest or a Select Case. I'd
use InStr like I did in the example rather than insist on a complete match
as the printer name is often appended with network descriptions when you use
Application.ActivePrinter.


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top