How to make 'find' look at just 1st char in every line?

J

JKap

I am trying to delimit the WORD "find and replace" function so that it just
looks at the very first character of every line. For example, I have a large
document that begins each line with a period. I want to find . and replace
it with { .

Honest and non-insulting replies / suggestions are appreciated.
 
D

Doug Robbins - Word MVP

If each line in your document is a separate paragraph, put ^p in the Find
what control and ^p{ in the Replace with control

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
G

Graham Mayor

While Doug's method will work (apart from the first line), again assuming
each line is a paragraph, you could use a macro

Dim oRng As Range
With ActiveDocument
For i = 1 To .Paragraphs.Count
Set oRng = .Paragraphs(i).Range
If oRng.Characters(1) = "." Then
oRng.Characters(1) = "{"
End If
Next i
End With

If you want a space after the bracket, then add that space between the
quotes.
oRng.Characters(1) = "{ "

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top