Trong văn vản word mình nếu không có từ sent mà chạy code thì sẽ bị treo máy
Nếu tìm thấy "sent" thì .Execute sẽ chọn từ "sent" nhưng nếu không tìm thấy là bị treo máy, xin mọi người cách khắc phục !Cần phải dùng .Execute vì đằng sau còn mã code nếu không dùng .Execute thì code đằng sau không chạy được
Mã:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.text = "sent"
.Replacement.text = "gui"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute
End With
Selection.Find.Execute Replace:=wdReplaceOne