Specifying a printer

  • Thread starter Thread starter Guest
  • Start date Start date
See:
Reports: Change printers from code
at:
http://www.mvps.org/access/reports/rpt0009.htm

If you are using Access 2002 or later, you can use the Printer object from
the Printers collection.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jedster said:
Is it possible to specify a printer in VBA and can anyone please give an
example?
 
If you are using a2002 or later, you can use:

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current defualt printer.
strDefaultPrinter = Application.Printer.DeviceName

' swtich to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

If you are using an earlier version of ms-access, then you can grab my SHORT
printer switch code, and it lets you do the above like:

Thus, when printing a report, you can:

1) save the default printer into a string

strCurrentPtr = GetDefaultPrinter

2) switch to your report printer

SetDefaultPrinter strReportsPtr

' 3) print report

4) switch back to the default printer

SetDefaultPrinter strCurrentPtr

So, if using an earlier version of ms-access, then you can get my short and
easy printer change code at:

http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
 
Back
Top