word vba实现文档里,每个字的字体都是随机指定的几个字体,如图
2个回答
展开全部
Sub fonts()
Dim arr()
Set fontlist = Application.CommandBars("formatting").FindControl(ID:=1728)
For i = 1 To fontlist.ListCount
If Asc(Left(fontlist.List(i), 1)) < 0 Then
n = n + 1
ReDim Preserve arr(1 To n)
arr(n) = fontlist.List(i)
End If
Next
a = ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
For n = 0 To a
Selection.Start = n
Selection.End = n + 1
Selection.Font.Name = arr(Int((UBound(arr) - 1 + 1) * Rnd + 1))
Next
End Sub
展开全部
Sub Font() '
' Font 宏
' 更改所选内容的字体
Dim arr(5)
arr(1) = "okme"
arr(2) = "楷体"
arr(3) = "okme"
arr(4) = "楷体"
arr(5) = "okme"
a = ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
For n = 0 To a
Selection.Start = n
Selection.End = n + 1
Selection.Font.Name = arr(Int((UBound(arr) - 1 + 1) * Rnd + 1))
Next
End Sub
以上内容来自感谢沪-沉香屑(14164910)大神
能行了,真是隔行如隔山
非常感谢
' Font 宏
' 更改所选内容的字体
Dim arr(5)
arr(1) = "okme"
arr(2) = "楷体"
arr(3) = "okme"
arr(4) = "楷体"
arr(5) = "okme"
a = ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
For n = 0 To a
Selection.Start = n
Selection.End = n + 1
Selection.Font.Name = arr(Int((UBound(arr) - 1 + 1) * Rnd + 1))
Next
End Sub
以上内容来自感谢沪-沉香屑(14164910)大神
能行了,真是隔行如隔山
非常感谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |