2 Quick Ways to Auto Fit Tables to Contents or Page in Your Word Document

This article is cropped to provide you with 2 quick and manageable ways to auto fit tables to contents or Page in your Word document.

Inserting a table to hold data is now inevitable in Word using. More often than not, we don’t stop in merely having a table but try to make it look great in document. This means we will need to properly adjust table size accordingly.

Now, let’s first take a look at occasions when we must change a table size:

  1. It’s pretty often to insert a new page in landscape orientation. Then you originally perfect table could be too small in the new page setup.
  2. The size of table cells intends to change according to word numbers. This absolutely will undermine the document outlook.

See the example below:An Example

Next, let’s get down to our business today to introduce you the 2 solutions here.

Method 1: Alter Manually

  1. First and foremost, click to select the whole table.
  2. Then, click “Layout” tab under “Table Tools”.
  3. Next, go to “Cell Size” group to click “AutoFit”.
  4. And on the drop-down menu, choose what you need accordingly, such as “AutoFit Contents” or “AutoFit Window”. The former means to change table size according to contents size, while the latter refers to change of table size due to page setup.Select Table ->Click "Layout" ->Click "AutoFit" ->Choose Options Accordingly

Here is what you may get:Effect of Choosing "AutoFit Contents"

 

Effect of Choosing AutoFit Window

As you can see, this method works best when there are only a few tables to manage. However, when a large number of tables are involved, let’s take a more smart and quick way.

Method 2: Use VBA Codes to Do it in Batch

  1. To begin with, make sure your “Developer” tab is available in the Ribbon and click it. If not, click here and jump to this article: How to Insert Background Music into Your Word Document
  2. Then, click “Visual Basic” in “Code” group to open VBA editor.
  3. On the left “Project” pane, find the project with document name after it. And click “ThisDocument”.
  4. Next, click “Insert” on toolbar.
  5. And choose “Module” on the list.Click "ThisDocument" ->Click "Insert" ->Choose "Module"
  6. Now the editing area shall expand on the right side. If you want to AutoFit tables according to contents, you should paste the following codes there:
Private Sub AutoFitContentsForAllTables()
  If ActiveDocument.Tables.Count > 0 Then
    Dim objTable As Object

    Application.Browser.Target = wdBrowseTable
    For Each objTable In ActiveDocument.Tables
      objTable.AutoFitBehavior (wdAutoFitContent)
    Next
  End If
End Sub
  1. Or if you need to AutoFit tables according to window width, the bellowing codes are helpful:
Private Sub AutoFitWindowForAllTables()
  If ActiveDocument.Tables.Count > 0 Then
    Dim objTable As Object

    Application.Browser.Target = wdBrowseTable
    For Each objTable In ActiveDocument.Tables
      objTable.AutoFitBehavior (wdAutoFitWindow)
    Next
  End If
End Sub
  1. Once you finish there, just click “Run”.Paste Code ->Click "Run"

Take Care of Your Information

Generally, there must be hundreds of thousands irreplaceable information stored on your digital devices. To be honest, it’s quite tiresome to manage every piece of them properly. One way we can do without much cost should be taking backups. It helps to keep these files stay safe and sound. However, no guarantee can be made. For instance, the Word we use almost every day can stop working all of a sudden. That time you will need a tool to recover corrupt Word.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged Excel fix tool and pdf repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *