|
下面的一段代码目的是要将一个EXcel文件的所有sheet字体的格式统一,
运行提示"不能设置类Font的name属性", 如何解决??
Sub Macro2()
Dim r As Integer, r1 As Integer
r = 1
r1 = Excel.Worksheets.Count + 1
Do While r < r1
Sheets(r).Select
Cells.Select
With Selection.Font
.Name = "宋体"
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Font
.Name = "Arial"
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
r = r + 1
Loop
ActiveWorkbook.Save
MsgBox "字体统一完成."
End Sub |
|