Share via

Replace First space

Anonymous
2011-10-23T03:33:40+00:00

Is there anyway to replace only the first space after the first tab in that row with comma in microsoft word 2010

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-10-24T06:02:13+00:00

The following looks at the first 'word' in the paragraphs. Word treats a tab character as a 'word', so if the first 'word' is not a tab character (as in your first example), this version adds a tab character to the start of the second 'word'

Dim oPara As Paragraph

Dim oRng As Range

For Each oPara In ActiveDocument.Paragraphs

    If oPara.Range.Words.Count > 1 Then

        If oPara.Range.Words(1).Text <> Chr(9) Then

            Set oRng = oPara.Range.Words(2)

            oRng.InsertBefore Chr(9)

        End If

    End If

Next oPara

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-10-23T15:13:29+00:00

    No, We want to break the rows without tab after the first space not in begining of paragraph 

    ex:

    kol (insert break) dave is going (break first space)

    ^t kol dave is going (no break)

    Was this answer helpful?

    0 comments No comments