|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
因为排专业文档,要排一些很特殊的字符,附件文档中的特殊字符是“方正C-KT”字体(此字体压缩包中有)符号,直接在Word文档中输入,即使电脑上有“方正C-KT”字体,也一般不能显示,而是显示为空白,如果再选中设为“方正C-KT”字体,则可正确显示。我想将文档中的这类符号通过VBA一次性设置,代码是:
Sub SetFont()
'
Dim my2Function() As Variant, a2Array As Variant
'指定更改内容,如需要,可扩充数组
my2Function = Array("", "", "", "", "", "", "", "", _
"", "", "", "", "", "", "", "")
'将指定内容文本改为C-KT体
With ActiveDocument.Content.Find
For Each a2Array In my2Function
.ClearFormatting
.MatchCase = False
.MatchCase = True
.Text = a2Array
With .Replacement
.ClearFormatting
.Font.Name = "C-KT"
' .Font.NameFarEast = "C-KT"
End With
.Execute Replace:=wdReplaceAll
Next
End With
End Sub
测试结果没有作用,不知为什么?怎样改进以达到目的呢?
|
|