J
Jen
Hi,
I tried this code and added Body.Delete and Body.Copy
BUT on text below it selects from BEGINNING OF DOC to last character - it
does not select period at end of sentence. It is supposed to select from
below DEAR.
How do I refine the code to select text between DEAR and also select the
period in the last sentence before YOURS.
I want to COPY the selection
And to DELETE the selection.
My date is a FIELD and starts at top of page on a SAVED document.
28 October 2006
Dear Mr Jones
Heading
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
Yours faithfully
XXXXXX
***CODE STARTS
Public Sub BodyDelete()
Dim Body As Range
Set Body = ActiveDocument.Range
Body.Start = Body.Start + InStr(Body, "Dear")
Body.Start = Body.Start + Len(Body.Paragraphs(1).Range) - 1
Body.End = Body.Start + InStr(Body, "Yours") - 1
Body.Select
Body.Copy
Body.Delete
End Sub
Thanks for any ideas.
I tried this code and added Body.Delete and Body.Copy
BUT on text below it selects from BEGINNING OF DOC to last character - it
does not select period at end of sentence. It is supposed to select from
below DEAR.
How do I refine the code to select text between DEAR and also select the
period in the last sentence before YOURS.
I want to COPY the selection
And to DELETE the selection.
My date is a FIELD and starts at top of page on a SAVED document.
28 October 2006
Dear Mr Jones
Heading
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
Yours faithfully
XXXXXX
***CODE STARTS
Public Sub BodyDelete()
Dim Body As Range
Set Body = ActiveDocument.Range
Body.Start = Body.Start + InStr(Body, "Dear")
Body.Start = Body.Start + Len(Body.Paragraphs(1).Range) - 1
Body.End = Body.Start + InStr(Body, "Yours") - 1
Body.Select
Body.Copy
Body.Delete
End Sub
Thanks for any ideas.