PC Review


Reply
Thread Tools Rate Thread

Change printers

 
 
Colin Hammond
Guest
Posts: n/a
 
      29th Jan 2006
Can I write code to change the printer? I want to use a command button that
produces some information on A4 sheets and then produces an address label on
a label printer.

Colin


 
Reply With Quote
 
 
 
 
Albert D.Kallal
Guest
Posts: n/a
 
      29th Jan 2006
You don't mention what version\ of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

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 default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

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

do whatever....print reports...etc...

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)


If you are using a earlier versions, then you can use my lightweight printer
switch code here:

http://www.members.shaw.ca/AlbertKal.../msaccess.html


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)
http://www.members.shaw.ca/AlbertKallal


 
Reply With Quote
 
Colin Hammond
Guest
Posts: n/a
 
      29th Jan 2006
Thanks I should have mentioned that I am using Access 97 with windows XP
"Albert D.Kallal" <(E-Mail Removed)> wrote in message
news:eMBt$(E-Mail Removed)...
> You don't mention what version\ of ms-access.
>
> In access 2002 and later, there is a built in printer object, and it lets
> you switch the printer with ease.
>
> 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 default printer.
> strDefaultPrinter = Application.Printer.DeviceName
>
> ' switch to printer of your choice:
>
> Set Application.Printer = Application.Printers("HP LaserJet Series II")
>
> do whatever....print reports...etc...
>
> Swtich back.
>
> Set Application.Printer = Application.Printers(strDefaultPrinter)
>
>
> If you are using a earlier versions, then you can use my lightweight
> printer switch code here:
>
> http://www.members.shaw.ca/AlbertKal.../msaccess.html
>
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
> http://www.members.shaw.ca/AlbertKallal
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mass change of printers in OU? Matthew Clark Microsoft Windows 2000 Printing 0 17th Aug 2006 08:48 PM
Outlook should let me change printers. =?Utf-8?B?bGFyLnJpZGdl?= Microsoft Outlook Discussion 3 31st Jul 2006 11:20 PM
Script to change printers jay.griffin@burke.com Microsoft Windows 2000 Printing 0 10th Mar 2005 07:28 PM
Change Printers in VBA Bill Agee Microsoft Excel Programming 1 1st Nov 2004 09:02 PM
Change Printers BE Guy Microsoft Outlook VBA Programming 1 29th Jan 2004 03:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:47 AM.