View Single Post
 
Old 11-12-2021, 08:21 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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

Try this alternative approach to see if you are still getting the same issue.
Code:
Sub TextSplitter2()
  Dim Rng As Range, iStep As Long, iStart As Long, iEnd As Long
  Application.ScreenUpdating = False
  With ActiveDocument
    iStep = 500
    iStart = 0
    Do While iStart < .Range.End - iStep
      If iStart + iStep > .Range.End Then
        iEnd = .Range.End
      Else
        iEnd = iStart + iStep
      End If
      Set Rng = .Range(iStart, iStart + iStep)
      If Rng.Characters.Last.Text = vbCr Then
        iStart = iStart + iStep
      Else
        Set Rng = .Range(Rng.Sentences.Last.Start, Rng.Sentences.Last.Start)
        Rng.InsertAfter vbCr & "*** "
        iStart = Rng.End
      End If
    Loop
  End With
  Set Rng = Nothing
  Application.ScreenUpdating = True
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote