|
发表于 2020-10-29 11:27
来自手机
|
显示全部楼层
本帖最后由 zhanglei1371 于 2020-10-29 13:55 编辑
不涉及挪移,VBa很简单。
Sub test()
startwd = Array("简述")
ActiveDocument.Range.InsertBefore "." & Chr(13)
Dim fd As Field
Set fd = ActiveDocument.Fields.Add(ActiveDocument.Range(0, 0), wdFieldEmpty, "seq aa")
fd.Update
Set temprg = ActiveDocument.Paragraphs(1).Range
temprg.End = temprg.End - 1
temprg.Select
With ActiveDocument.Range.Find
.Text = "简述"
Do While .Execute
ActiveDocument.Range(.Parent.Start, .Parent.Start).FormattedText = temprg.FormattedText
myen = .Parent.Paragraphs(1).Range.End
ActiveDocument.Range(myen - 1, myen - 1).InsertAfter "。"
.Parent.Paragraphs(1).Range.InsertAfter "【参考答案】"
.Parent.Paragraphs(1).Range.Font.Bold = 1
.Parent.End = .Parent.End + 50
.Parent.Collapse 0
Loop
End With
ActiveDocument.Range.Paragraphs(1).Range = ""
ActiveDocument.Fields.Update
End Sub
|
评分
-
1
查看全部评分
-
|