2 Means to Batch Resize All Tables to Fit Contents or Window in Your Outlook Email

When composing an email that contains a lot of tables in message body, if you want to batch resize all tables to fit contents or current window, you can utilize the methods shared in this article.

After creating several tables in an email, so as to make the email contents aligned and orderly, you may hope to resize all the tables to fit the contents or the current message window. In this case, if there are only two or three tables, you can just use the in-built “AutoFit” table feature to resize them one by one, as introduced in the following Method 1. But, if there are multiple tables, you had better use the Method 2, which uses VBA code to easily realize “Batch Resize”.

Method 1: Resize Tables One by One via “AutoFit” Feature

  1. First of all, in the open email, place the cursor over a table.
  2. Then, click the cross icon in the left upper corner of the table to select it.
  3. Next, access the “Layout” tab in the “Table Tools” ribbon.
  4. Here, find and select the “AutoFit” option.
  5. Now, select “AutoFit Contents” or “AutoFit Window” as per your needs. The following screenshot shows the result of the example – “AutoFit Window”.AutoFit Window
  6. At once, the selected table is fit to window.Resize a Table to Fit Window
  7. After that, you can use this way to resize the other tables one by one.

Method 2: Batch Resize with Outlook VBA

  1. At the beginning, keep the email opened.
  2. Subsequently, trigger Outlook VBA editor via “Alt + F11”.
  3. Next, put the following VBA code into a module or project.
Sub ResizeAllTables_FitContentsOrWindow()
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objTables As Word.Tables
    Dim i As Integer
    Dim objTable As Word.Table
 
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Set objMailDocument = objMail.GetInspector.WordEditor
    Set objTables = objMailDocument.Tables
 
    If objTables.Count > 0 Then
       For i = 1 To objTables.Count
           Set objTable = objTables.Item(i)
 
           'Fit the window
           objTable.AutoFitBehavior wdAutoFitWindow
 
           'Fit the contents, use the following line instead
           'objTable.AutoFitBehavior wdAutoFitContent
       Next
    End If
End Sub

VBA Code - Batch Resize All Tables to Fit Contents or Window

  1. Then, directly press “F5” key button to run this macro.
  2. When macro finishes, return to the email. You’ll find that all the tables have been resized to auto fit the message window.All Tables Get Resized to Fit Window

Handle Outlook Troubles with Agility

It is known that users can experience various problems in Outlook, like common error messages, sudden being stuck and abrupt auto restarting, catastrophic data file corruption and so on. The corresponding solutions should vary with the kind of issues. For instance, to fix tiny errors, you can simply employ the inbox repair tool. But, in case of serious problems, such as problems with PST files, you ought to resort to a robust and well-proven external repair tool, such as DataNumen Outlook Repair to fix PST file.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql fix and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.