Print macro which automatically identifys default printer

J

Jules

Problem - I have several printers with different numbers of trays
(some 2, some 3) and they're diferent types they call their trays
different names.

I create print macros to print letter head (first page from top tray,
other pages from lower tray, then entire copy on white for file) until
now I've been creating print macros for each type of printer but it's
getting time consuming to amend them and visit each PC to load normal
on.

Any ideas how to write a print macro which can detect which printer
you're connected to and print leterheads?
 
J

Jonathan West

Jules said:
Problem - I have several printers with different numbers of trays
(some 2, some 3) and they're diferent types they call their trays
different names.

I create print macros to print letter head (first page from top tray,
other pages from lower tray, then entire copy on white for file) until
now I've been creating print macros for each type of printer but it's
getting time consuming to amend them and visit each PC to load normal
on.

Any ideas how to write a print macro which can detect which printer
you're connected to and print leterheads?

You can find the name of the current printer by reading the ActivePrinter
property.

You can find out which paper trays are available on that printer by the
means described in this article

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

You will find it easier to maintain and distribute macros if you don't use
normal.dot. Take a look at this article

Distributing macros to other users
http://word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm
 
J

Jules

Thanks for the reply, the print macros will be in an addin template,
leaving normal alone. But I got a problem with the macro for showing
active printers:-

But at the stage "Sub Printer_List3()" the line ... Public Declare
Function GPString Lib "kernel32.dll" Alias "GetProfileStringA" (ByVal
lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As
String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
.... is highlighted and I get a Compile Error: only comments may appear
after End Sub, End Function oor End Property.

Any ideas?
 

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