一个VBA问题.WORD文档/

来源:百度知道 编辑:UC知道 时间:2024/05/26 01:36:23
在word中设计一个子程序,将当前文档所有"宋体.小四号.加粗"字体的文本复制到另一个文档中/

Sub ddd()
Dim msg As String
msg = Selection.Text
Selection.Find.Text = msg
Selection.HomeKey unit:=wdStory
Selection.Find.Execute
While Selection.Find.Found()
With Selection.Font
.Name = "宋体"
.Size = 12
.Bold = True
End With
Selection.Find.Execute
Wend
Selection.Find.Wrap = wdFindContinue
Selection.Find.Execute
Selection.Copy
Set docn = New Document
docn.SaveAs FileName:="cfc.doc"
Selection.Collapse
Selection.Paste
End Sub