Word |
Set App = CreateObject("Word.Application") ' app.Visible = True App.Documents.Add OpenFiles Set odoc = App.ActiveDocument With App ' j = 0 Do While j < i ' .Selection.Find.ClearFormatting .Selection.Find.Replacement.ClearFormatting With .Selection.Find.Replacement .Font.Color = 0 End With With .Selection.Find ' Debug.Print xm(j), ym(j) .Text = xm(j) If ym(j) = " - " Then .Replacement.Text = " " Else .Replacement.Text = ym(j) End If .Wrap = 1 .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With ' .Selection.Find.Execute Replace:=2 ' If .Selection.Find.Execute() = True Then - ' If .Selection.Find.Execute() = True Then .Selection.Find.Execute Replace:=2 ' Replace=wdReplaceAll=2 - j = j + 1 Loop App.Selection.HomeKey Unit:=6 DoEvents End With
.Selection.Find.Execute Replace:=2
If .Selection.Find.Execute() = True Then .Selection.Find.Execute Replace:=2