View Single Post
 
Old 11-09-2023, 08:44 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 macro
Code:
Sub SpaceBalls()
  Dim aRng As Range, aSty As Style
  Set aRng = ActiveDocument.Content
  Set aSty = ActiveDocument.Styles(wdStyleHtmlPre)
  aSty.ParagraphFormat.Alignment = wdAlignParagraphDistribute
  With aRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^g"
    .Replacement.Text = "^& "
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = False
    .Execute Replace:=wdReplaceAll
    .Text = "[ ]{2,}"
    .Replacement.Text = " "
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
    .Format = True
    .Text = "^g"
    .Replacement.Text = "^&"
    .MatchWildcards = False
    .Replacement.Style = aSty 
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote