Group: microsoft.public.word.vba.general
From: =?Utf-8?B?U0hld2Vz?=
Date: Tuesday, April 08, 2008 10:37 AM
Subject: RE: Search within a range

Try this

Set meNotice = ActiveDocument.Sections(ActiveDocument.Sections.Count).Range

meNotice.Select
Selection.Find.Text = "time shown below."
If Selection.Find.Execute Then
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.InsertAfter Chr$(13) & "PLEASE TELEPHONE ME IMMEDIATELY."
End If


-------------------
S. Hewes


"Elaine J." wrote:

> I have defined a range. Now I need to be able to search for a specific
> phrase, move to the end of that phrase, insert a carriage return and insert a
> new phrase. This is what I was trying, but it is not working. I don't get
> any errors. It just doesn't work. I'm pretty sure it has something to do
> with meNotice vs. selection. But I just can't quite figure out the syntax.
> Any help would be greatly appreciated.
>
> Set meNotice = .Sections(.Sections.Count).Range
>
> With meNotice.Find
> .Text = "time shown below."
> If .Execute Then
>
> Selection.MoveRight Unit:=wdCharacter, Count:=2
> Selection.InsertAfter Chr$(13) & "PLEASE TELEPHONE ME IMMEDIATELY."
>
> End If
> End With