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

posted @ 2016-01-04 22:58  风与叶子  阅读(4059)  评论(0编辑  收藏  举报