
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?
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.