- Joined
- May 16, 2018
- Messages
- 1
- Reaction score
- 0
I will appreciate your help to fix the error with this code. I used to run the macro without problem working on Word 2007, but working on Word 2016 I got this problem.
When I run the macro, it shows me the run time error 5560.
This is the macro:
Sub CleanUpPastedText()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Text = "([!^13])([^13])([!^13])"
.Replacement.Text = "\1 \3"
.Execute Replace:=wdReplaceAll
.Text = "([ ])[ ]{1,}"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
.Text = "[!^13]{2,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Text = "[!^13]"
.Execute Replace:=wdReplaceAll
End With
End Sub
Thank you very much in advance folks.
When I run the macro, it shows me the run time error 5560.
This is the macro:
Sub CleanUpPastedText()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Text = "([!^13])([^13])([!^13])"
.Replacement.Text = "\1 \3"
.Execute Replace:=wdReplaceAll
.Text = "([ ])[ ]{1,}"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
.Text = "[!^13]{2,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Text = "[!^13]"
.Execute Replace:=wdReplaceAll
End With
End Sub
Thank you very much in advance folks.