View Single Post
 
Old 09-27-2018, 12:35 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

In that case maybe
Code:
Sub Macro1()
Dim oRng As Range
Dim oWord As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(FindText:="_")
            Set oWord = oRng.Duplicate
            If oWord.Words(1).Start <> ActiveDocument.Range.Start Then
                oWord.MoveStartUntil Chr(32), wdBackward
                oWord.MoveEndUntil Chr(32) & Chr(13)
                If InStr(1, oWord.Text, "@") = 0 Then oRng.Text = " "
            End If
            oRng.Collapse 0
        Loop
    End With
lbl_Exit:
    Set oRng = Nothing
    Set oWord = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote