|
发表于 2024-3-23 22:44
来自手机
|
显示全部楼层
本帖最后由 过客fppt 于 2024-3-24 07:10 编辑
Sub 你的代码()
.......你的代码的最后加
Call 批量设置字体1("本文字数*页数:[0-3]{1,}", "仿宋", 3, True)
End Sub
Function 批量设置字体1(原文字, 字体为, 颜色为, 通配符, Optional ByVal 加粗 As Boolean = False)
Dim rng As Range
Set rng = IIf(Len(Selection.Range.text) <= 1, ActiveDocument.Content, Selection.Range)
With rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = 原文字
.Forward = True
.MatchWildcards = 通配符 '通配符开关
With .Replacement
.Font.Name = 字体为
.Font.Name = "Times New Roman"
.Font.ColorIndex = 颜色为 'wdDarkRed
.Font.Bold = 加粗
End With
End With
rng.Find.Execute Replace:=wdReplaceAll
批量设置字体1 = rng.Find.Found
Set rng = Nothing
End Function
|
评分
-
2
查看全部评分
-
|