Group: microsoft.public.word.vba.general
From: Alan Stancliff
Date: Thursday, February 28, 2008 8:50 PM
Subject: Re: Selecting Specific Range Within A Document Without Search (Word 2003)

Thanks Doug,

I'll be sure to play with that as soon as I get off work.

In the lines that say:
myrange.Start = myrange.start + InStr(myrange, ",")
myrange.End = myrange.Paragraphs(1).Range.End

That includes everything from the comma to the paragraph marker,
including the marker. How would I alter that second line to include
everything up to the paragraph marker but not the paragraph marker itself?

Regards,

Alan Stancliff

Doug Robbins - Word MVP wrote:
> You make use of the Instr() command to determine the amount by which the
> .Start of the Range (myrange) must be used and then set the .End of the
> Range to the .End of the Range of the Paragraph
>
> Dim myrange As Range
> Set myrange = ActiveDocument.Range
> myrange.start = myrange.start + InStr(myrange, "MY OTHER SAMPLE WORDS
> TO SELECT") + 32
> myrange.Start = myrange.start + InStr(myrange, ",")
> myrange.End = myrange.Paragraphs(1).Range.End
> MsgBox myrange.Text
>

Safety Articles | Usenet Groups | Usenet News | Bluegrass