Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2017, 06:14 AM
Macfool Macfool is offline VBA to print pages either double sided or single sided based on footer Windows 10 VBA to print pages either double sided or single sided based on footer Office 2010 32bit
Novice
VBA to print pages either double sided or single sided based on footer
 
Join Date: Mar 2017
Location: Australia
Posts: 2
Macfool is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 03-04-2017, 07:21 AM
gmayor's Avatar
gmayor gmayor is offline VBA to print pages either double sided or single sided based on footer Windows 10 VBA to print pages either double sided or single sided based on footer Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 03-05-2017, 08:50 AM
Macfool Macfool is offline VBA to print pages either double sided or single sided based on footer Windows 10 VBA to print pages either double sided or single sided based on footer Office 2010 32bit
Novice
VBA to print pages either double sided or single sided based on footer
 
Join Date: Mar 2017
Location: Australia
Posts: 2
Macfool is on a distinguished road
Default

Thanks gmayor i was thinking this was not going to be possible with VBA but you never know if you don't ask.
Reply With Quote
  #4  
Old 03-27-2017, 06:16 AM
gmayor's Avatar
gmayor gmayor is offline VBA to print pages either double sided or single sided based on footer Windows 10 VBA to print pages either double sided or single sided based on footer Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes


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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft