同时按Alt和F11进入宏界面,点菜单的插入,模块,粘贴如下代码:
Subtest()
Selection.HomeKeywdStory
Selection.Find.Text="关键字"
Selection.Find.Execute
Selection.Paragraphs(1).Range.Copy
Documents.Add
Selection.Paste
EndSub
这个代码,把查找到的第一个“关键字”所在的段落,复制到一个新的文档里。
ThisDocument.Paragraphs(3)ThisDocument.Paragraphs(3).Range.SelectSelection.Font.Size = 12Selection.Font.ColorIndex = wdRed上面语句表示文档的第三段落的内容,供你参考。