作者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/m.aspx?n=bbs/Office/M.1526441555.A.9FF.html