问题描述
将word中的标准表格设为论文常用的三线表格。
解决方法
Sub TablLine3()
' 三线表格式设置
Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
Options.DefaultBorderLineWidth = wdLineWidth100pt
With Selection.Borders(wdBorderTop)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
Options.DefaultBorderLineWidth = wdLineWidth100pt
With Selection.Borders(wdBorderBottom)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
Options.DefaultBorderLineWidth = wdLineWidth025pt
With Selection.Rows(1).Borders(wdBorderBottom) '第一行的底边框
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
End Sub
使用示例
-
Alt + F11
进入word VBA编程模块,将以上代码拷贝到此处;
TabLine3.jpg-206.2kB -
Alt + F8
进入宏运行选项; - 运行
TabLine3
;
macro.jpg-193.2kB -
处理结果;
Demo.jpg-56.6kB
网友评论