批量修改WORD表格屬性


有時候需要對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

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM