Print to non-default printer

I

Imrahn Gamildien

Hello

I need VBA code to open a document and print it to a printer other than the
default printer. Please could someone help out.

Thanks
Imrahn
 
M

Malcolm Smith

For example:

Dim sCurrentPrinter as string

on error resume next

sCurrentPrinter = ActivePrinter
ActivePrinter = "AnotherPrinter"
ActiveDocument.TypeText "I must try to look at the Help files, "
ActiveDocument.TypeText "once in a while for myself."
ActiveDocument.PrintOut

ActivePrinter = sCurrentPrinter


- Malc
 
S

Sergio

The Word VBA command ActivePrinter reveals the name of the current printer in
use by Word. Is there a way of returning the name of the Windows default
printer?

I need the name of the Windows default printer to check against the
ActivePrinter and if they are not the same, let the user know he/she needs to
change printers before continuing.
Thank you

Sergio
 
J

Jonathan West

Sergio said:
The Word VBA command ActivePrinter reveals the name of the current printer in
use by Word. Is there a way of returning the name of the Windows default
printer?

I need the name of the Windows default printer to check against the
ActivePrinter and if they are not the same, let the user know he/she needs to
change printers before continuing.
Thank you

Hi Sergio,

All you can passibly want to do with printers can be found here
http://www.mvps.org/vb/samples.htm

Scroll down to the prnInfo.zip sample.

The code is written in VB, but should import into a VBA project perfectly
happily
 

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