View Single Post
 
Old 06-24-2017, 05:59 PM
eduzs eduzs is offline Windows 10 Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default

I returned to this version of my code:

This should be a bug of word vba? I found that the loop/crash ocurrs only when theres a ^p^p at the end of the document.

Sub Limpa_texto()

Application.ScreenUpdating = False

ActiveDocument.Select

With Selection

With .Find

.Text = "^13{2}"
.Replacement.Text = "^13"
.Forward = True
.MatchWildcards = True
.Wrap = wdFindStop
.Execute

End With

Do While .Find.Found

.Find.Execute Replace:=wdReplaceAll

Loop

End With

Application.ScreenUpdating = True

End Sub
__________________
Backup your original file before doing any modification.
Reply With Quote