Setting column widths for all tables in a document
<p>I have multiple tables in word document each having 6 columns. I want to fix the width of each column in all tables, I have following script.</p>

<p>And it keeps giving me <code>value out of the range</code> error.</p>

<pre><code>Sub FormatTables()
    Dim t As Table
    For Each t In ActiveDocument.Tables
        If t.Columns.Count = 6 Then
            t.Range.Select
            Selection.ClearFormatting

            t.AutoFitBehavior _
            wdAutoFitWindow

            't.Rows.DistributeHeight
            t.Rows.WrapAroundText = True
            t.Rows.Height = 0.15

            t.Columns.DistributeWidth

            'tried this way 
            t.Columns(1).Width = 1.5 'value out of the range
            t.Columns(2).Width = 1.5
            t.Columns(3).Width = 6.49
            t.Columns(4).Width = 6.49
            t.Columns(5).Width = 0.8
            t.Columns(6).Width = 0.8

            'as well as this            
            t.Columns(1).SetWidth ColumnWidth:=1.5, _
            RulerStyle:=wdAdjustProportional 'value out of the range
            t.Columns(2).SetWidth ColumnWidth:=1.5, _
            RulerStyle:=wdAdjustProportional
            t.Columns(3).SetWidth ColumnWidth:=6.49, _
            RulerStyle:=wdAdjustProportional
            t.Columns(4).SetWidth ColumnWidth:=6.49, _
            RulerStyle:=wdAdjustProportional
            t.Columns(5).SetWidth ColumnWidth:=0.8, _
            RulerStyle:=wdAdjustProportional
            t.Columns(6).SetWidth ColumnWidth:=0.8, _
            RulerStyle:=wdAdjustProportional

            Debug.Print t.Cell(2, 1).Range.Text
        End If

    Next
End Sub
</code></pre>