Duplexing

S

Sasquatch

Is there an easy way to turn a printer's duplex option on when a document is
opened in a multi-user environment?

For instance, I have a 10 page document that should be duplexed any time it
is printed by any user on our network. Is there some simple code I can add
that would be run whenever the document is opened by a user to turn their
default printer's duplexing on (vertical/book)? It would also need to turn
off when the document closes (if it doesn't automatically reset on close).

Thanks in advance.
 
J

Jonathan West

Sasquatch said:
Is there an easy way to turn a printer's duplex option on when a document
is
opened in a multi-user environment?

For instance, I have a 10 page document that should be duplexed any time
it
is printed by any user on our network. Is there some simple code I can
add
that would be run whenever the document is opened by a user to turn their
default printer's duplexing on (vertical/book)? It would also need to
turn
off when the document closes (if it doesn't automatically reset on close).

Thanks in advance.

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

Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
S

Sasquatch

Can you give me a little more insight on how to set this up?

Sadly, I'm a complete noob when it comes to VBA in Word. I do program
extensively in Access, but I've never had a reason to learn about adding
modules to Word documents so I don't know how to get it started.

I basically understand what the code from your link is doing, I just don't
know how to call it when the document opens. I added the chunk of code from
the end of the web page to its own module for the document I'm working on,
then I added the following to the code under 'ThisDocument':

'====================================
Option Explicit

private iDuplex As Long

Sub SetDuplexOnOpen()
iDuplex = GetDuplex 'save the current setting
SetDuplex 3 'set for vertical binding
End Sub

Sub ResetDuplexOnClose()
SetDuplex iDuplex 'restore the original setting
End Sub
'====================================

How would I have SetDuplexOnOpen() run automatically when the document opens
and run ResetDuplexOnClose() when the document is closing. I'm thinking
along the lines of the Form_Open and Form_Close subs from Access which always
fire, so maybe I'm approaching this incorrectly, but I don't want to rely on
any user interactions to change the printer settings.

Thanks again.
 
J

Jonathan West

The only time it matters whether the duplex option is set is when you
actually want to print the document.

In the second of the articles I referred to you, the PrintDuplexBooklet
macro does the following

1. Stores the current duplex setting
2. Sets the printer to duplex
3. Prints the document
4. Restores the original duplex setting.

As I understand it, that is exactly what you need, so that documents based
on this particular template always print duplex, but the setting is not
affected for any other document.

If you want this to happen automatically for documents based on your
template, simply include the code from my article in your template, and then
rename the PrintDuplexBooklet macro to FilePrintDefault. When you click on
the print icon on the toolbar to print a document based on your template,
the macro will then run instead of Word's built-in command. The Print button
will continue to do a default print for any document not based on your
template.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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