#1
|
|||
|
|||
VBA to print pages either double sided or single sided based on footer
Is it possible to print pages from a document either double sided or single sided based on the footer. I have a document with up to 80 pages some are 2 pages some are 1 page, in the footer on the left hand side it says 1 of 1 or 1 0f 2, is it possible for vba to determine this and print the pages either 1 sided or double sided. |
#2
|
||||
|
||||
The short answer is no. Duplex options are not accessible to VBA.
If your printer accepts PCL commands, you may be able to use a PRINT field. A PRINT field is simply a type of field that allows you to send instructions directly to the printer. There are 3 possible data values for duplex setting: PRINT 27"&l0S" simplex PRINT 27"&l1S" vertical duplex . PRINT 27"&l2S" horizontal duplex (bookformat) The codes after PRINT are 27 (escape), double quote, ampersand, lowercase L, 0, 1 or 2, uppercase S and finally terminated with a double quote. Thus for horizontal duplex you would insert the following field : { PRINT 27"&l2S" }
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks gmayor i was thinking this was not going to be possible with VBA but you never know if you don't ask.
|
#4
|
||||
|
||||
I recently came across http://www.excelgaard.dk/Lib/PrinterDuplex/ while looking for something else. Here you will find a Windows.dll file that adds the functionality to determine and switch printer modes from VBA. I have added it here for completeness, should anyone else be searching for it later.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Office 2016 cannot use printer configuration - auto double sided printing | edspyhill01 | Word | 9 | 05-02-2016 03:12 PM |
Two-sided printing with sequential numbering | BruceM | Word VBA | 3 | 03-05-2015 10:37 AM |
Formatting single sided thesis with indented tables for double sided printing | Akshara | Word | 1 | 05-01-2014 01:29 PM |
Printing Double Sided Cards 4/page HELP PLEASE! | C.J. | Word | 5 | 03-27-2012 07:29 AM |
Print Multiple Sheets Double-Sided | flambe99 | Excel | 1 | 03-12-2010 01:15 PM |