Google Answers Logo
View Question
 
Q: How do I print only page 1 from multiple Word documents ( Answered,   0 Comments )
Question  
Subject: How do I print only page 1 from multiple Word documents
Category: Computers > Software
Asked by: jnhn-ga
List Price: $30.00
Posted: 01 Sep 2004 06:35 PDT
Expires: 01 Oct 2004 06:35 PDT
Question ID: 395547
Environment  -  Windows 2K,  MSWord 2K
I have a folder with 89 individual Word documents in it.  I need to be able to
print the first page only for each of the documents.  I want to avoid having
to open each document and select criteria from the "file > print" process.
Answer  
Subject: Re: How do I print only page 1 from multiple Word documents
Answered By: palitoy-ga on 01 Sep 2004 07:51 PDT
 
Hello Jnhn

I do not know of a simple way of doing this so I have written a small
VBA macro to accomplish the task.  The script replies on knowing where
the documents are stored on your computer and you need to tell it this
by altering the script slightly (look for a line - strPath =
"C:\word\" - in the script and alter the C:\word\ part to the location
of your files).

This is how to use the script:

1) Open Word
2) Go to Tools->Macro->Macros
3) A pop-up window should appear and in the box called "Macro Name"
type: PrintAllWordDocs
4) Click "Create"
5) A new window will open ("Microsoft Visual Basic") with a cursor
flashing in a section between "Sub PrintAllWordDocs()" and "End Sub". 
Copy the following text *between* these points (remember to change the
location of your files in the third line below!):

Dim strFileName As String
Dim strPath As String
strPath = "C:\word\"
strFileName = Dir(strPath + "*.doc", vbNormal)
Do While strFileName <> ""
 Documents.Open FileName:=strPath + strFileName, ConfirmConversions:=False, _
 ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
 PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
 WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
 wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _
 ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
 False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
 PrintZoomPaperHeight:=0
Documents.Close
strFileName = Dir
Loop

6) Press Ctrl-S to save and then close this window down.
7) In Word, now go to Tools->Macro->Macros (as you did in step 2
above) and there should be an entry called "PrintAllWordDocs" in the
list in this window.  Left click on this name.
8) Click Run.  This will then print out the first page in each document.

Hopefully if everything runs smoothly this will do the job for you. 
If it does not work or you need further help please ask for
clarfication and I will do my best to help.

If you do need further help setting this up it would be helpful to
know the folder on your computer that holds the files, the version of
Word you are using and your level of expertise at using Word macros (I
sometimes inadvertently cut corners when telling people things without
realising it!).

Request for Answer Clarification by jnhn-ga on 01 Sep 2004 08:36 PDT
Thanks !  
This works great, except for one very tiny little thing -

Because Word senses that there has been a "change" to the document, the pop-up
window asking if I want to save changes has to be answered for all 189
documents.  Can this message be directed to a "dev/null" type
environment>

For clarification contact me at 720-427-4242.

This is my first attempt at a VBS macro and I really appreciate your help !!

Jim Nation

Clarification of Answer by palitoy-ga on 01 Sep 2004 09:14 PDT
Hello Jim

Unfortunately we are not allowed personal contact with other users
through the Google Answers (GA) forum and all contact has to be made
through clarifications through the GA website.

For clarification, is the problem you are having this: when the
document is opened and printed a window pops up asking you to save the
document?

This does not happen on my test machine here but I will look into this for you...

Clarification of Answer by palitoy-ga on 01 Sep 2004 09:28 PDT
Hello again Jim

I am not sure if this will solve your problem (as I cannot replicate
it here) but you could try changing the Documents.Close line to:

Documents.Close (False)

This should tell Word not to save the document when it is closed.

Request for Answer Clarification by jnhn-ga on 01 Sep 2004 11:15 PDT
Again, THANKS

Your suggestion worked perfectly.  Your help has saved me a lot
of trouble and extra work.

Clarification of Answer by palitoy-ga on 01 Sep 2004 11:21 PDT
Glad I could help!
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy