PrintRange - How To?

G

George Shubin

OK. I was finally able to get my documents to print to different logical
printers by using the following code:

Options.PrintBackground = False

' Print the appropriate number of copies for each section of the document.
ActivePrinter = "STAPLER" 'Assign Printer-Stapler
ActiveDocument.PrintOut Background = False, Range = wdPrintRangeOfPages,
Pages = "1-4"

ActivePrinter = "TOSHIBA 550" 'Assign Printer
ActiveDocument.PrintOut Background = False, Range = wdPrintRangeOfPages,
Pages = "5"

ActivePrinter = "STAPLER" 'Assign Printer-Stapler
ActiveDocument.PrintOut Background = False, Range = wdPrintRangeOfPages,
Pages = "6-7"

Options.PrintBackground = True


I had to use Options.PrintBackground=False for some reason. If I didn't,
all the documents would print to the first ActivePrinter designated.

BUT....

The print range doesn't work. The entire document prints 3 times. I tried:
Range = wdPrintRangeOfPages, Pages = "1-4"
and I tried
Range:=wdPrintFromTo, From:="1", To:="4"

Neither works as advertised. Am I doing something wrong?

Thanks.
 
P

Peter Hewett

Hi George Shubin

Your code should read:
ActiveDocument.PrintOut Background := False, Range := wdPrintRangeOfPages, _
Pages := "1-4"

You are using named arguments and use must specify the argument name using ":=" not just
"=".

If that still does not fix your problem try using:

ActiveDocument.PrintOut Background := False, Range := wdPrintFromTo, _
From := 1, To := 4

HTH + Cheers - Peter
 

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