PC Review


Reply
Thread Tools Rate Thread

change paper size

 
 
Brie
Guest
Posts: n/a
 
      26th Feb 2008
hi!

how to change the size of the paper of a group of word documents? say from
A4 to legal.

I have around 200 files and don't want to open them one by one.

thanks a bunch!
 
Reply With Quote
 
 
 
 
Doug Robbins - Word MVP
Guest
Posts: n/a
 
      26th Feb 2008
A macro containing the following code would set the paper size to legal for
all of the documents in the C:\Test folder:

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

PathToUse = "C:\Test\" 'Change the name of the folder to the one where all
of your documents are located.
'Close all open documents before beginning
Documents.Close SaveChanges:=wdPromptToSaveChanges
'Set the directory and type of file to batch process
myFile = Dir$(PathToUse & "*.doc")
While myFile <> ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
myDoc.PageSetup.PaperSize = wdPaperLegal
'Close the modified document after saving changes
myDoc.Close SaveChanges:=wdSaveChanges
'Next file in folder
myFile = Dir$()
Wend


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Brie" <(E-Mail Removed)> wrote in message
news:F0603E48-0A87-4764-B109-(E-Mail Removed)...
> hi!
>
> how to change the size of the paper of a group of word documents? say from
> A4 to legal.
>
> I have around 200 files and don't want to open them one by one.
>
> thanks a bunch!



 
Reply With Quote
 
Robert M. Franz (RMF)
Guest
Posts: n/a
 
      26th Feb 2008
Hello Brie

Brie wrote:
> how to change the size of the paper of a group of word documents? say from
> A4 to legal.
>
> I have around 200 files and don't want to open them one by one.


well, somebody or something has to open them, one by one. [Unless they
are in XML and you write code to run through that -- would probably work
faster, if you have the right devs at hand ... :-)]

Yes, code can do it for you. An example of a VBA routine that opens all
files in a given folder and "does something" (here: a Replace run) can
be found here:

http://www.mvps.org/word/FAQs/MacrosVBA/BatchFR.htm

If you can adjust this code to your needs or have somebody ready with
the right experience, it's faster. Otherwise, try one of the .word.vba
groups. Your code probably needs to loop through the sections collection
and adjust the page size in all of them.

0.2cents
Robert
--
/"\ ASCII Ribbon Campaign | MSFT |
\ / | MVP | Scientific Reports
X Against HTML | for | with Word?
/ \ in e-mail & news | Word | http://www.masteringword.eu/
 
Reply With Quote
 
Brie
Guest
Posts: n/a
 
      29th Feb 2008
This is very helpful. Thanks Doug!

Brima

"Doug Robbins - Word MVP" wrote:

> A macro containing the following code would set the paper size to legal for
> all of the documents in the C:\Test folder:
>
> Dim myFile As String
> Dim PathToUse As String
> Dim myDoc As Document
>
> PathToUse = "C:\Test\" 'Change the name of the folder to the one where all
> of your documents are located.
> 'Close all open documents before beginning
> Documents.Close SaveChanges:=wdPromptToSaveChanges
> 'Set the directory and type of file to batch process
> myFile = Dir$(PathToUse & "*.doc")
> While myFile <> ""
> 'Open document
> Set myDoc = Documents.Open(PathToUse & myFile)
> myDoc.PageSetup.PaperSize = wdPaperLegal
> 'Close the modified document after saving changes
> myDoc.Close SaveChanges:=wdSaveChanges
> 'Next file in folder
> myFile = Dir$()
> Wend
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Brie" <(E-Mail Removed)> wrote in message
> news:F0603E48-0A87-4764-B109-(E-Mail Removed)...
> > hi!
> >
> > how to change the size of the paper of a group of word documents? say from
> > A4 to legal.
> >
> > I have around 200 files and don't want to open them one by one.
> >
> > thanks a bunch!

>
>
>

 
Reply With Quote
 
Brie
Guest
Posts: n/a
 
      29th Feb 2008
Will look the .word.vba groups. to adjust the code - as you suggest Robert!
Afterall, I need to have some exercise for my brain.
Thanks a lot.

Brie


"Robert M. Franz (RMF)" wrote:

> Hello Brie
>
> Brie wrote:
> > how to change the size of the paper of a group of word documents? say from
> > A4 to legal.
> >
> > I have around 200 files and don't want to open them one by one.

>
> well, somebody or something has to open them, one by one. [Unless they
> are in XML and you write code to run through that -- would probably work
> faster, if you have the right devs at hand ... :-)]
>
> Yes, code can do it for you. An example of a VBA routine that opens all
> files in a given folder and "does something" (here: a Replace run) can
> be found here:
>
> http://www.mvps.org/word/FAQs/MacrosVBA/BatchFR.htm
>
> If you can adjust this code to your needs or have somebody ready with
> the right experience, it's faster. Otherwise, try one of the .word.vba
> groups. Your code probably needs to loop through the sections collection
> and adjust the page size in all of them.
>
> 0.2cents
> Robert
> --
> /"\ ASCII Ribbon Campaign | MSFT |
> \ / | MVP | Scientific Reports
> X Against HTML | for | with Word?
> / \ in e-mail & news | Word | http://www.masteringword.eu/
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot change paper size Tacrier Microsoft Excel Misc 2 19th Feb 2009 01:18 AM
OL2003 print options -change page size w/o changing paper size =?Utf-8?B?a3JlbmVl?= Microsoft Outlook Calendar 0 30th Nov 2005 06:42 PM
Cannot change paper size news.system.saab.se Windows XP Embedded 0 14th Oct 2004 10:51 AM
Paper Size won't change Bill Microsoft Access Reports 0 21st Apr 2004 08:35 PM
Change Paper Size Jorge Riva Portocarrero Windows XP Print / Fax 1 15th Sep 2003 08:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:40 AM.