word 使用宏批量设置表格

Sub ChangeTable()

Application.Browser.Target = wdBrowseTable

    For i = 1 To ActiveDocument.Tables.Count

        ActiveDocument.Tables.Item(i).Select

        With Selection
    
            '表格外边框
            .Borders.OutsideLineStyle = wdLineStyleSingle
            '表格内边框
            .Borders.InsideLineStyle = wdLineStyleSingle
            '表格内边框
            .Borders(wdBorderRight).Color = wdColorAutomatic
            .Borders(wdBorderLeft).Color = wdColorAutomatic
            .Borders(wdBorderTop).Color = wdColorAutomatic
            .Borders(wdBorderBottom).Color = wdColorAutomatic
            '表格居中
            .Rows.Alignment = wdAlignRowLeft
            '表格内容居中
            .Range.Paragraphs.Alignment = wdAlignParagraphLeft
            
        End With
    
    Next i

End Sub

相关链接:http://blog.chinaunix.net/uid-20423564-id-1949478.html

原文地址:https://www.cnblogs.com/lixiuran/p/5100562.html