- pdf转换成word,pdf转word:Word文档损坏修复的几种实用方法
- word制作表格教程基础入门:word2010格式刷怎么用?word2010格式刷工具使用方法步骤
- word制作表格教程基础入门:Word表格中将文字大小适应单元格
- word文档制作ppt教程:如何设置Word文档的对齐选项卡?Word文档对齐选项卡的小技巧
VBA代码设置Word表格属性。
Dim i As Table,pdf转换成word,pdf转word,word教程网, N As Integer
On Error Resume Next ’忽略错误
Application.ScreenUpdating = False ’关闭屏幕更新
For Each i In ActiveDocument.Tables ’在表格中循环
With i
.Style = "列表型 4" ’将所有表格设置为"列表型4"的样式
With .Borders ‘边框
.InsideLineStyle = wdLineStyleSingle ’设置内部边框线条
End With
With .Rows(1).Borders(wdBorderBottom) ‘第一行的底边框
.LineStyle = wdLineStyleDouble ‘双线型
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
If .Rows.Count > 1 Then ’ 如果表格行数大于1
If Len(.Cell(2,word怎么删除空白页, 1).Range) <= 2 Then ’如果第二行第一列不为空
With .Rows(2).Shading ’设置底纹
.Texture = wdTextureNone ’无底底纹
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorGray125
End With
End If
End If
For N = 2 To .Columns.Count ’从第二列到最后一列
.Columns(N).Select ’单元格对齐方式为中部居中
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Next N
End With
Next i
Application.ScreenUpdating = True
以上的代码功能为:表格集合中的循环与对单元格边框的设置。
上一篇:word文档编辑教程:设置Word表格的VBA代码 下一篇:word文档教程:快速找到并选择word字体的方法
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。