View Single Post
 
Old 04-19-2017, 12:27 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Quote:
Originally Posted by Tye30 View Post
I think I mislead you in my last post.
Indeed. Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrTmp As String
With Selection
  .Start = .Paragraphs.First.Range.Start
  .End = .Paragraphs.First.Range.End - 1
  StrTmp = Trim(Replace(Replace(.Text, "|Z|", "ZR"), "|", ""))
  Do While InStr(StrTmp, "  ") > 0
    StrTmp = Replace(StrTmp, "  ", " ")
  Loop
  .Text = StrTmp
End With
Application.ScreenUpdating = True
End Sub
With this code, it will process any paragraph you click in - you don't have to select the entire paragraph beforehand
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote