有時候需要對word中很多表格的屬性進行修改,而word無法批量修改屬性,所有這里記錄一個宏
Sub TableFormatter() Dim oTbl As Table, i As Integer For Each oTbl In Selection.Tables With oTbl .Rows.AllowBreakAcrossPages = False .Rows(1).HeadingFormat = True For i = 1 To .Columns.Count If i = 1 Then .Columns(i).Width = InchesToPoints(1.19) If i = 2 Then .Columns(i).Width = InchesToPoints(2#) If i = 3 Then .Columns(i).Width = InchesToPoints(1.19) If i = 4 Then .Columns(i).Width = InchesToPoints(2#) If i = 5 Then .Columns(i).Width = InchesToPoints(2.62) Next End With Next End Sub