作者dcjamesw (dcjamesw)
看板Office
标题[文件] 请问WORD的巨集要如何执行到文件最後?
时间Wed May 16 11:32:32 2018
软体: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
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 123.51.221.156
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Office/M.1526441555.A.9FF.html