word 解放双手,使用宏批量添加word中表格边框以及自适应

Sub 宏2()
'
' 宏2 宏
'
'
For Each aTable In ActiveDocument.Tables
    With aTable
        aTable.Select
        With .Borders(wdBorderLeft)
           .LineStyle = wdLineStyleSingle
          .LineWidth = wdLineWidth050pt
          .Color = wdColorAutomatic
        End With
        With .Borders(wdBorderRight)
          .LineStyle = wdLineStyleSingle
          .LineWidth = wdLineWidth050pt
          .Color = wdColorAutomatic
        End With
        With .Borders(wdBorderTop)
          .LineStyle = wdLineStyleSingle
          .LineWidth = wdLineWidth050pt
          .Color = wdColorAutomatic
        End With
        With .Borders(wdBorderBottom)
          .LineStyle = wdLineStyleSingle
          .LineWidth = wdLineWidth050pt
          .Color = wdColorAutomatic
        End With
        With .Borders(wdBorderHorizontal)
         .LineStyle = wdLineStyleSingle
         .LineWidth = wdLineWidth050pt
         .Color = wdColorAutomatic
        End With
        With .Borders(wdBorderVertical)
        .LineStyle = wdLineStyleSingle
        .LineWidth = wdLineWidth050pt
        .Color = wdColorAutomatic
         End With
        .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
        .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
        .Borders.Shadow = False
        End With
        With Options
        .DefaultBorderLineStyle = wdLineStyleSingle
        .DefaultBorderLineWidth = wdLineWidth050pt
        .DefaultBorderColor = wdColorAutomatic
        End With
        aTable.AutoFitBehavior (wdAutoFitWindow)
        Next aTable

End Sub

word 解放双手,使用宏批量添加word中表格边框以及自适应

    原文作者:千亦Zz
    原文地址: https://blog.csdn.net/q939059425/article/details/120739781
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞