bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Macros > Repaginating Your Document in a Macro

Repaginating Your Document in a Macro

Summary: Macros can be used to do extensive processing on a document. After the processing, you may want to repaginate the document. You can do so using the Repaginate method, as described here. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)

It is common to use macros to modify documents in some way. For instance, you might use a macro to insert text or to insert page, column or section breaks. Doing any of these actions can affect the pagination of a document, sometimes dramatically. If you modify the document using a macro, and then try to determine the page count of the document (using the BuiltInDocumentProperties property), Word will not return the proper number of pages. Instead, it will return the page count before the changes were made.

The solution is to always make sure that you force Word to repaginate before trying to determine the page count. The following method will do the repagination:

ActiveDocument.Repaginate

After this method has been executed, you can safely (and confidently) use the BuiltInDocumentProperties property to determine the current page count.

Tip #352 applies to Microsoft Word versions: 97 | 2000 | 2002 | 2003


Save Time! You can have this tip (and several hundred just like it) in the WordTips annual archives. Imagine having over 400 tips available at your fingertips, in each annual volume.

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Vital News Home

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)