[文件] 请问WORD的宏要如何执行到文件最后?

楼主: dcjamesw (dcjamesw)   2018-05-16 11:32:32
软件:word
版本:2007
我录制了一个宏
大致上就是,找到一个样式,然后在它前、后各加上一个特殊符号
但只能执行一次
请问要如何一直执行到文件最后呢?
附上我的宏:
Sub 套word()
'
' 套word 宏
'
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("word")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="★"
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("word")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="☆"
End Sub
作者: soyoso (我是耀宗)   2018-05-16 12:13:00

Links booklink

Contact Us: admin [ a t ] ucptt.com