|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我这有个表格处理的宏,也还算可以用,只是字体处理的不好,我最终是要表格里的汉字用五号宋体,而数字和字母用”Times New Roman“字体,麻烦帮我看一下要怎么修改。万分感谢!
Sub 表格处理()
On Error Resume Next
Dim t As Table, n As Long
If Selection.Information(wdWithInTable) = True Then Selection.Tables(1).Select: n = 1
For Each t In ActiveDocument.Tables
If n = 1 Then Set t = Selection.Tables(1) Else t.Select
With t
With .Rows
.WrapAroundText = False
.Alignment = wdAlignRowLeft
.HeightRule = wdRowHeightAtLeast
.Height = CentimetersToPoints(0.65)
End With
With .Range
With .Cells
.DistributeWidth
.VerticalAlignment = wdCellAlignVerticalCenter
End With
.Font.Size = 10.5
With .ParagraphFormat
.Alignment = wdAlignParagraphCenter
.CharacterUnitFirstLineIndent = 0
.FirstLineIndent = CentimetersToPoints(0)
.Space1
End With
End With
.Shading.BackgroundPatternColor = wdColorAutomatic
.AutoFitBehavior (wdAutoFitContent)
.AutoFitBehavior (wdAutoFitContent)
.Select
.AutoFitBehavior (wdAutoFitWindow)
.AutoFitBehavior (wdAutoFitWindow)
With .Rows(1).Range.Font
.Name = "宋体"
.Name = "Times New Roman"
End With
Options.DefaultBorderLineWidth = wdLineWidth150pt
With Selection.Borders(wdBorderTop)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderLeft)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderBottom)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderRight)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
End With
If n = 1 Then Exit For
Next
End Sub
|
|