发布时间:2026-07-21阅读(1)
人有悔意,请天怜之。人有悔意,请天怜之。人有悔意,请天怜之。
使用表格样式进行批量调整表格格式如果不知道表格样式的,可以去看一下解析Word——Word法宝「样式」之「表格样式」。
如果你Word文章中有许多表格的格式要调整成一致,建议你使用表格样式进行批量调整,而不是用格式刷去刷。比如你的文章中有很多表格,想调整为统一格式的三线表,你可以建立一种三线表式去调整。如下图所示:

使用【表格样式】 【全选表格】进行批量调整表格格式
本文将讲述如何使用VBA代码建立三线表样式
建立三线表表格样式代码Sub 三线表表格样式() b = False Set MyDoc = ActiveDocument MyTableName = "三线表" For Each MyStyle In MyDoc.Styles If MyStyle.NameLocal = "三线表" Then Application.StatusBar = "该样式已存在!" Exit Sub Else b = False End If Next If b = False Then ActiveDocument.Styles.Add Name:=MyTableName, Type:=wdStyleTypeTable 整体表格字体设置 With ActiveDocument.Styles(MyTableName).Font .NameFarEast = "宋体" .NameAscii = "Times New Roman" .NameOther = "Times New Roman" .Name = "Times New Roman" .Size = 10.5 End With 整体表格段落设置 With ActiveDocument.Styles(MyTableName).ParagraphFormat .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphCenter .SpaceAfter = 0 End With With ActiveDocument.Styles(MyTableName).Table .Alignment = wdAlignRowCenter .AllowPageBreaks = True .AllowBreakAcrossPage = True End With 整体表格边框线设置 With ActiveDocument.Styles(MyTableName).Table.Borders .OutsideLineStyle = False .InsideLineStyle = False End With With ActiveDocument.Styles(MyTableName).Table.Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle End With 标题行边框设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdFirstRow) With .Borders(wdBorderTop) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt End With With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt End With End With 标题行段落格式设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdFirstRow). _ ParagraphFormat .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphCenter End With 标题行字体格式设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdFirstRow).Font .NameFarEast = "黑体" .NameAscii = "Times New Roman" .NameOther = "Times New Roman" .Name = "Times New Roman" .Size = 10.5 End With 汇总行边框线设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdLastRow).Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt End With 汇总行段落格式设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdLastRow).ParagraphFormat .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphCenter End With 汇总行字体格式设置 With ActiveDocument.Styles(MyTableName).Table.Condition(wdLastRow).Font .NameFarEast = "宋体" .NameAscii = "Times New Roman" .NameOther = "Times New Roman" .Name = "Times New Roman" .Size = 10.5 End With End If Application.StatusBar = "三线表表格样式新建完毕!"End Sub

将代码复制到VBE窗口中

执行代码建立三线表样式
Copyright © 2024 有趣生活 All Rights Reserve吉ICP备19000289号-5 TXT地图HTML地图XML地图