View Single Post
 
Old 06-01-2021, 01:33 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote