View Single Post
 
Old 07-08-2022, 06:14 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,465
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could just change:
FindText:="[^13]{3,}"
to:
FindText:="[^13]{2,}"
and leave:
ReplaceWith:="^p^p"
alone.

Alternatively, you might modify the Dim line at the top of the UpdateDocuments sub, thus:
Code:
Dim strInFolder As String, strFile As String, Sctn As Section, HdFt As HeaderFooter, Rng As Range
and change:
Code:
        With HdFt
          If .Exists Then .Range.Find.Execute FindText:="[^13]{3,}", ReplaceWith:="^p^p", MatchWildcards:=True, Replace:=wdReplaceAll
        End With
to:
Code:
        With HdFt
          If .Exists Then
            Set Rng = .Range.Characters.Last
            With Rng
              Do While .Start > HdFt.Range.Start
                If .Characters.First.Previous = vbCr Then
                  .Start = .Start - 1
                Else
                  Exit Do
                End If
              Loop
              If .Paragraphs.Count > 2 Then .Text = vbCr & vbCr
            End With
          End If
        End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote