Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Duplexing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sasquatch - 04 Apr 2007 18:30 GMT
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.
Jonathan West - 04 Apr 2007 22:31 GMT
> Is there an easy way to turn a printer's duplex option on when a document
> is
[quoted text clipped - 10 lines]
>
> 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

Signature

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

Sasquatch - 05 Apr 2007 20:12 GMT
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.
Jonathan West - 16 Apr 2007 14:41 GMT
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.

Signature

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

> Can you give me a little more insight on how to set this up?
>
[quoted text clipped - 33 lines]
>
> Thanks again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.