Thanks for your reply! The tables I am working with
should follow a set criteria, but they are often slightly different and sometimes drastically different (unfortunately). The standard layout contains 3 rows:
Row 1 = repeating title row
Row 2 = column 1 vertically merged with row 3; criteria in columns 2-4
Row 3 = column 1 vertically merged with row 2; column 2-4 horizontally merged
I'm attaching an example for a visual.
Below are some attempts I've made. Note that they're not all complete and I know they don't work with merged cells. Do any of these attempts look promising for what I am trying to do?
PHP Code:
Sub TableFormat()
'
'
'
'
Dim oCell As Cell
Dim oTable As Table
Dim oRow As Row
Dim oColm As Column
''attempt 1 below
For Each oTable In ActiveDocument.Tables
oTable.Rows.Height = InchesToPoints(1.5)
oTable.AutoFitBehavior wdAutoFitFixed
oTable.Columns.Width = InchesToPoints(2.3)
Next oTable
'tried changing all columns to same width first to make updates easier
For Each oTable In ActiveDocument.Tables
For Each oCell In oTable.Columns
With oCell
oCell.Cells(1).Width = InchesToPoints(0.45)
If oRow.Cells.Count = 2 Then
oRow.Cells(2).Width = InchesToPoints(6.2)
ElseIf oRow.Cells.Count = 4 Then
oRow.Cells(2).Width = InchesToPoints(1.5)
oRow.Cells(3).Width = InchesToPoints(2.38)
oRow.Cells(4).Width = InchesToPoints(2.33)
Else
End If
End With
Next oCell
Next oTable
''attempt 2 below
For Each oTable In ActiveDocument.Tables
oTable.Columns(1).Width = InchesToPoints(0.45)
oTable.Columns(2).Width = InchesToPoints(1.5)
oTable.Columns(3).Width = InchesToPoints(2.38)
oTable.Columns(4).Width = InchesToPoints(2.33)
For Each oRow In oTable.Rows
If oRow.Cells.Count = 2 Then
oRow.Cells(2).Width = InchesToPoints(6.2)
End If
Next oRow
Next oTable
''attempt 3 below
For Each oTable In ActiveDocument.Tables
With oTable.Columns(1)
.Width = InchesToPoints(0.45)
End With
''attempt 4 below
For Each oTable In ActiveDocument.Tables
With oTable.Rows(1)
If oCell.ColumnIndex = 1 Then
oCell.Width = InchesToPoints(0.45)
End If
End With
Next oTable
''attempt 5 below
For Each oTable In ActiveDocument.Tables
.Tables .Cell(1, 1).Width = InchesToPoints(0.45)
Next oTable
''attempt 6 below
For Each oCell In ActiveDocument.Tables
With oCell(1, 1) = True
.Width = InchesToPoints(0.45)
End With
Next oCell
End Sub