Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now
Free Printable Forms

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

Advertise on the
WordTips Site

Newest Tips

Arranging Document Windows

Specifying a Backup Location

Controlling Chart Gridlines

Merging Table Cells

Collapsing and Expanding Subdocuments

Zooming With the Keyboard

Initiating a New Search

 

Fitting Text Into Cells

Summary: Need a way to make sure your text fits within the space available in a table cell? Word has a handy setting that will adjust your text's format, as necessary, to make it fit. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)

You have worked long and hard on your page design, including a couple of tables that are just right. Then, along comes a need to add a bit more text into one of the tables. The result is that the text in a cell wraps and pushes everything else down a bit. Now your whole design is thrown off! You long for a way to automatically adjust the size of the text in a cell so you won't have the wrapping and pushing occur.

If you are using Word 2000, Word 2002, or Word 2003 there is a built-in option that may do the trick. Simply follow these steps:

  1. Select the cell or cells that you want to format.
  2. Choose Table Properties from the Table menu. The Table Properties dialog box is displayed.
  3. If necessary, select the Cell tab. (Click here to see a related figure.)
  4. Click on the Options button. Word displays the Cell Options dialog box. (Click here to see a related figure.)
  5. Make sure the Fit Text check box is selected.
  6. Click on OK to close the Cell Options dialog box.
  7. Click on OK to close the Table Properties dialog box.

This same option is available in Word 2007 by following these steps:

  1. Select the cell or cells that you want to format.
  2. Make sure the Layout tab of the ribbon is displayed. (This tab is only visible if you first do step 1.)
  3. Click the Properties tool in the Table group. Word displays the Table Properties dialog box.
  4. Select the Cell tab.
  5. Click on the Options button. Word displays the Cell Options dialog box.
  6. Make sure the Fit Text check box is selected.
  7. Click on OK to close the Cell Options dialog box.
  8. Click on OK to close the Table Properties dialog box.

What Word does is to decrease the apparent size of the text so that everything fits. Word decreases the width of the text by "scrunching" (a highly technical term) the text together horizontally, without adjusting it vertically.

If you are using Word 97, there is no inherent way to accomplish the task. Word doesn't provide any properties you can check to determine the width of various characters, each of which could be different sizes and have other attributes. You can, however, create a macro that may help you by displaying the width of a text string in points or inches. For instance, the following VBA macro displays an input box so you can input your string, displays the Font dialog box so you can specify font and point size, and then displays the width of the resulting string.

Sub GetStringLength()
    Dim sngInitPos As Single
    Dim sngEndPos As Single
    Dim strText As String
    Dim sngLength As Single

    strText = InputBox("Enter the string whose length you want to determine")
    Documents.Add
    Dialogs(wdDialogFormatFont).Show

    sngInitPos = Selection.Information(wdHorizontalPositionRelativeToPage)
    Selection.InsertAfter strText
    Selection.EndOf
    sngEndPos = Selection.Information(wdHorizontalPositionRelativeToPage)
    sngLength = sngEndPos – sngInitPos

    MsgBox "Your string has a length of " & sngLength & _
        " points, or " & PointsToInches(sngLength) & " inches."
    ActiveDocument.Close savechanges:=False
End Sub

The only difficulty with this macro, of course, is that it isn't "automatic." For instance, it won't adjust the size of a text string to the maximum size possible to fit within a cell. In the long run it may be easier to just experiment with different font sizes for information in the cell until you find the right size for your needs.

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

More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.
 
Check out WordTips: The Macros today!