View Single Post
 
Old 05-01-2021, 04:00 PM
jeffreybrown jeffreybrown is offline Windows 10 Office 2016
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Find word and replace tab with two spaces

I have a paragraph

MESSAGE: What Storm Goers Need to Know

Between the "MESSAGE:" and the What is a tab character, but I would like to replace that tab character with two spaces.

This is the macro I found to find the paragraph that starts with MESSAGE, just not sure how to replace the tab character with two spaces.

Note: I added the With ORng.Find part to see if that would work. Apparently not.

Code:
Sub CleanUp()
    Dim oRng As Word.Range: Set oRng = ActiveDocument.Range
    With oRng.Find
            .Text = "MESSAGE:"
        While .Execute
            With oRng.Paragraphs(1).Range
                With oRng.Find
                    .Text = "^t"
                    .Replacement.Text = "  "
                End With
                    oRng.Find.Execute Replace:=wdReplaceAll
            End With
        Wend
    End With
End Sub
Reply With Quote