|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 wlskk 于 2017-8-24 15:52 编辑
求问下,
复制了一段代码,稍微删减了一下。
Sub 表格处理()
On Error Resume Next
Dim t As Table
For Each t In ActiveDocument.Tables
With t.Rows
.WrapAroundText = False
.Alignment = wdAlignRowCenter
End With
With t.Range
.Font.Name = "宋体"
.Font.Name = "Times New Roman"
.Font.Size = 10.5
With .Cells
.VerticalAlignment = wdCellAlignVerticalCenter
End With
With .ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.RightIndent = CentimetersToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceMultiple
.LineSpacing = LinesToPoints(1.25)
.FirstLineIndent = CentimetersToPoints(0)
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
.WordWrap = True
End With
Options.DefaultBorderLineWidth = wdLineWidth150pt
With t.Borders(wdBorderTop)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With t.Borders(wdBorderLeft)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With t.Borders(wdBorderBottom)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With t.Borders(wdBorderRight)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
Next
End Sub
为啥一个WORD内的其它表格都是正常的,都能达到代码中的效果,只有财务报表是有问题的,问题如下:
第二张图是我自己手动加粗边框的,财务报表手动加粗边框就没问题,执行代码就变成那个鬼样,,,
|
|