
Tips.Net > WordTips Home > Tables > Expanding Width of All Tables
Summary: If you have a lot of tables in your documents, you might want to change the width of all of them. You can take forever doing it manually, or you can apply the simple macro in this tip to make quick work of the task. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
If you have a document that contains quite a few tables, you may be searching for a way to modify the width of all the tables in the document. For instance, your company standards may require that all tables be the same width, extending from the left to the right margin. If you have forty or more tables in a document, modifying the width of them all, individually, can be very tedious.
The following macro, ResizeAllTables, will quickly do what it says—resize all tables. The width of the tables are adjusted to fill the available margins.
Sub ResizeAllTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
oTbl.AutoFitBehavior wdAutoFitFixed
With ActiveDocument.PageSetup
oTbl.PreferredWidth = .PageWidth - .LeftMargin - .RightMargin
End With
Next oTbl
End Sub
After the macro is complete, you will still want to examine each table to make sure that your column widths are appropriate for your data, but the overall width of the tables will be as you expected.
Tip #1382 applies to Microsoft Word versions: 97 2000 2002 2003 2007
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.
Thousands of WordTips, available for immediate download. Have all the Microsoft Word info you need, right at your fingertips. (more information...)
Ask a Word Question
Make a Comment
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