Hello, Andrew,
I don't want to leave you with the impression, it worked all the time, cause in one case, it didn't. Didn't even flintch. So I want to let the readers here read it's not a 100% working script in those circumstances.
Besides, does it exist and 100% full proof script? Or it's normal, it might not work all the time? I guess it depends if one variable is different than the test I've done previously.
Quote:
Originally Posted by Guessed
This appears to work but I would need to see a big data set to be confident in it
Code:
Sub NoBreaksForTheWicked()
Dim aRng As Range, iLine1 As Integer, iLine2 As Integer
Set aRng = ActiveDocument.Range
With aRng.Find
.Text = "(\(<*) "
.Replacement.Text = "\1^l"
.Forward = True
.MatchWildcards = True
.Wrap = wdFindStop
Do While .Execute
iLine1 = aRng.Information(wdFirstCharacterLineNumber)
aRng.Collapse Direction:=wdCollapseEnd
iLine2 = aRng.Words(1).Information(wdFirstCharacterLineNumber)
If iLine2 <> iLine1 Then
aRng.MoveStart Unit:=wdCharacter, Count:=-1
aRng.Text = Chr(160)
End If
aRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End Sub
|
It's ok, the one from Macropod worked.
I rather have a backup plan, than just one. Especially when time is an issue.
Regardless, I love then help I get from this forum. I learn so much from people here
Until next time.
Cendrinne