|
WPS中运行效果:
代码:
Sub a()
Dim a(1 To 3) As String, i, j
Dim s(1 To 10) As String
a(1) = "来安县实验小学南校区一(3)班"
a(2) = "(2023——2024学年度第一学期)"
a(3) = "辅导员陈××老师对你说:"
s(1) = "朱茉萱:你是个聪颖伶俐活泼可爱的小姑娘,方方面面都能严格要求自己、成绩优异。"
s(2) = "郑梓阳:你是个活泼可爱的小男孩,能尊敬师长、团结同学,积极劳动。今后学习上多动脑筋会更好。"
s(3) = "胡立安:聪颖伶俐活泼可爱的小姑娘,方方面面都能严格要求自己、成绩优异。"
s(4) = "阮天雪:一个聪明伶俐活泼可爱的孩子,优点众多,老师喜欢这样的你。"
s(5) = "张梓:能尊敬老师,和同学能友好相处,比较遵守纪律,学习上再多下功夫你会更棒。"
s(6) = "李想:热爱劳动、团结同学、尊敬老师、能自觉守纪。"
s(7) = "徐果:聪明可爱,尊师敬长,友爱同学,学习努力认真。"
s(8) = "赵子涵:你学习较认真,作业能按时完成,遵守纪律和同学相处方面有待提高。"
s(9) = "周语涵:你是个聪慧伶俐、活泼可爱的小姑娘,优点众多、学习优秀。"
s(10) = "陈希尧:你是一个可爱的小女孩,能尊敬老师、团结同学、遵守纪律、劳动积极。"
For j = 1 To 10
For i = 1 To 3
Call 输入样式文字2(a(i), False, 20, "华文琥珀")
Selection.TypeParagraph
Next i
Call 输入样式文字2(s(j), False, 12, "宋体")
Selection.InsertBreak 7 '分页符
Next j
End Sub
Function 输入样式文字2(文字, Optional ByVal 加粗 As Boolean = False, Optional ByVal 字体大小 As Double = 10.5, Optional ByVal 字体 As String = "楷体")
Dim s%, j&
Dim rng As Range
s = Len(文字)
Selection.TypeText text:=文字
Selection.MoveLeft Unit:=wdCharacter, count:=s, Extend:=wdExtend ' 向前选中s位
Set rng = Selection.Range
j = rng.End
Selection.SetRange Start:=j, End:=j
With rng.Font
.Name = 字体
.ColorIndex = wdBlack
.Bold = 加粗
.Size = 字体大小
.SizeBi = 10.5
End With
Set rng = Nothing
End Function
|
|