Word macro 循环
Sub Macro2()
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Language=English"
.Forward = True
'.ClearFormatting
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchAllWordForms = False
.MatchWildcards = False
End With
Do While Selection.Find.Execute = True
Selection.Move unit:=wdLine, Count:=1
Selection.MoveDown unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.ClearFormatting
Selection.Move unit:=wdLine, Count:=1
Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
Do While Asc(Selection) <> 10 And Asc(Selection) <> 46 And Asc(Selection) <> 13
Selection.MoveDown unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.ClearFormatting
Selection.Move unit:=wdLine, Count:=1
Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
Do While Asc(Selection) <> 10 And Asc(Selection) <> 46 And Asc(Selection) <> 13
Selection.MoveDown unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.ClearFormatting
Selection.MoveDown unit:=wdLine, Count:=1
Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
Loop
Loop
Loop
End Sub
目的-->只执行一遍当前文档选择符合条件的字符串改变其字体,现在问题是:文档执行完后他不会停在文档末尾,程序会回到文档开始位置再执行第一个符合条件的字符串才能停止,问题出在什么地方,请教各位大侠,
高分悬赏
[解决办法]
有参数可指定的
Do While Selection.Find.Execute(Warp:=wdFindStop) = True