Im using this to clear my spaces, but i cant get it to work i only get a runtime error. Im doing it while the "userform initializes". So that the paragraphs will be cleaned
With Selection.Find
.Text = "^13{2,}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Dim MyRange As Range
Set MyRange = ActiveDocument.Paragraphs(1).Range
If MyRange.Text = vbCrLf Then MyRange.Delete
Set MyRange = ActiveDocument.Paragraphs.Last.Range
If MyRange.Text = vbCrLf Then MyRange.Delete
With Selection.Find
.Text = "^13{2,}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Dim MyRange As Range
Set MyRange = ActiveDocument.Paragraphs(1).Range
If MyRange.Text = vbCrLf Then MyRange.Delete
Set MyRange = ActiveDocument.Paragraphs.Last.Range
If MyRange.Text = vbCrLf Then MyRange.Delete