A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old June 11th, 2009, 10:09 PM posted to microsoft.public.word.docmanagement
JKap
external usenet poster
 
Posts: 1
Default How to make 'find' look at just 1st char in every line?

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.
  #2  
Old June 12th, 2009, 12:26 AM posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default How to make 'find' look at just 1st char in every line?

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
"JKap" wrote in message
...
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.


  #3  
Old June 12th, 2009, 05:52 AM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default How to make 'find' look at just 1st char in every line?

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




JKap wrote:
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.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.