Share via

Replace First Character

Anonymous
2015-03-24T19:11:57+00:00

I have a document in which I wish to replace the first character on all lines at once with a new character. Does someone know how I can accomplish that? Do note that Excel is not the answer, as the document contains 11,881,376 lines on which the first character must be replaced.

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

3 answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2015-03-24T23:33:18+00:00

    If you click on the Show\Hide button (¶), does each line terminate with a ¶?

    If so, you could use:

    Dim i As Long

    With ActiveDocument

        For i = 1 To .Paragraphs.count

            With .Paragraphs(i).Range

            .Text = "H" & Mid(.Text, 2)

            End With

        Next i

    End With

    replace the "H" with the new character that you want as the first in each line.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2015-03-29T08:04:01+00:00

    I am not really sure what you are saying as far as your original question is concerned.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-03-29T07:57:14+00:00

    Thank you for the reply, Doug. I did get the document finished, but it is too large. The document is composed of all 6-tile (6- to 12-letter, as the Q is always coupled with the U) combinations for a word game. The file is approximately 2.37 gibi (or 2.54 giga) bytes in size. Windows registers it as being 2.36 gigabytes in size, which is incorrect. The units don't match the mathematics used. The numeric value clearly reflects use of the binary system. But, the units reflect the decimal system.

    Was this answer helpful?

    0 comments No comments