Sign in to follow this  
Followers 0
rudi

Winword 2010 docx: Bulk change page settings, paper tray

4 posts in this topic

Hi.

I need to bulk check and change the page settings -> paper tray settings (first page, other pages) for several thousand word documents.

The reason is, that the former printer was a HP 2xxx, tray 2 was blank paper A4. Now that printer was retired, the printouts are handled by a Xerox Workcentre, that has to select the appropriate tray filled with A4 blank paper on it's own.

 

The secretaries now have to change the settings for 1st and all other pages from "Tray 2" to "Tray autoselect", otherwise the Xerox Workcentre won't print the jobs (-> Jobs get stuck: Wrong paper in Tray 2: A3).

 

And, no, switching the paper between the Xerox` trays is not an option, because then we would have the similar issue for other users using the same printer.

 

How to 

  1. search for DOCX files with fixed paper tray settings in the document's "Page Settings" (German: Seite einrichten)?
  2. change the "paper tray" settings to "Auto select tray" automatically?

 

Any suggestions appreciated, no matter, what's the approach. :D

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



Using Microsoft Word COM.

FirstPageTry and OtherPagesTray Property of the PageSetup object.

If you like this approach I can give you a stripped down version of the code. Using the Word UDF or my WordEX would be too slow.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi Water,

Thanks for your reply.

yes, of course I'm interested in your code as a draft to bulk change our DOCX.

 

A question upon your Word UDF or your WordEX:

Another approach might be to write a Autoit app, that...

  • is set as the default application for DOC/DOCX, so it's started, when such a document is double clicked.
  • Then it checks the standard printer (HP or Xerox Workcenter)
  • if HP, then set printer tray to "Tray Two"
  • if Xerox, then set printer trays to "select automatically"
  • Then start WinWord.exe %1

 

The Downside would be, that this way the word documents are always changed, when they are just opened. (Tivoli TSM Backup is doing incremental for ever. We keep all versions for 4 months, after that the latest 4 versions for ever. When I "touch" the DOCX exteranally with an autoit script *BEFORE* WinWord is opening them, this will trigger a new version even in case the document wasn't saved when exiting Winword)

 

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

In short (untested and without any error checking): 

#Include <WordEx.au3>
$oWord = _Word_Create()
; WdPapertray enumeration: http://msdn.microsoft.com/en-us/library/bb237921(v=office.12).aspx
Global Const $wdPrinterDefaultBin = 0
$aDocs = _FileListToArray(@ScriptDir, "*.docx") ; Process all *.docx in the current directory
For $i = 1 to $aDocs[0]
    $oDoc = _Word_DocOpen($oWord, $aDocs[$i])
    $oDoc.PageSetup.FirstPageTray = $wdPrinterDefaultBin
    $oDoc.PageSetup.OtherPagesTray = $wdPrinterDefaultBin
   ; Use _WordDocSave or _Word_DocSaveAs to save the document
    _Word_DocClose($oDoc)
Next
_Word_Quit($oWord)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0