Here's my requirement:

I have to find specific text located in various places in a
document. Once I identify the location of a spceific
character (ASCII 167 in this case), I need to locate the
VERY NEXT ")" character. My selected range must start at
the 167-char, and end at the ")" char. I then need to
replace the text in that range with a hotlink (easy enough
to do).

What I need to know is:

1) How to identify the absolute character position of the
first & last character, and set the RANGE to those values

2) Is there a different way to do that? If so, how?

I'm using vB6.

thanks!!

Re: Locating specific range points by Jonathan

Jonathan
Fri Aug 06 11:32:26 CDT 2004

Hi dennis,

Try this

Dim oRange as Range

Set oRange = ActiveDocument.Content
With oRange.Find
.Text = Chr$(167)
.Format = False
.Wrap = wdFindStop
If .Execute Then
oRange.MoveEndUntil CSet:=")"
'Apply your hyperlink to the text marked by oRange
Else
'char 167 not found
End If
End With

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

"dennis" <dennis.jx.olson@NOSPAMstate.mn.us> wrote in message
news:13e801c47bc6$c471a620$a301280a@phx.gbl...
> Here's my requirement:
>
> I have to find specific text located in various places in a
> document. Once I identify the location of a spceific
> character (ASCII 167 in this case), I need to locate the
> VERY NEXT ")" character. My selected range must start at
> the 167-char, and end at the ")" char. I then need to
> replace the text in that range with a hotlink (easy enough
> to do).
>
> What I need to know is:
>
> 1) How to identify the absolute character position of the
> first & last character, and set the RANGE to those values
>
> 2) Is there a different way to do that? If so, how?
>
> I'm using vB6.
>
> thanks!!


Re: Locating specific range points by dennis

dennis
Fri Aug 06 12:26:25 CDT 2004

Thanks! I'll try it!

Dennis

>-----Original Message-----
>Hi dennis,
>
>Try this
>
>Dim oRange as Range
>
>Set oRange = ActiveDocument.Content
>With oRange.Find
> .Text = Chr$(167)
> .Format = False
> .Wrap = wdFindStop
> If .Execute Then
> oRange.MoveEndUntil CSet:=")"
> 'Apply your hyperlink to the text marked by oRange
> Else
> 'char 167 not found
> End If
>End With
>
>--
>Regards
>Jonathan West - Word MVP
>www.intelligentdocuments.co.uk
>Please reply to the newsgroup
>
>"dennis" <dennis.jx.olson@NOSPAMstate.mn.us> wrote in
message
>news:13e801c47bc6$c471a620$a301280a@phx.gbl...
>> Here's my requirement:
>>
>> I have to find specific text located in various places
in a
>> document. Once I identify the location of a spceific
>> character (ASCII 167 in this case), I need to locate the
>> VERY NEXT ")" character. My selected range must start at
>> the 167-char, and end at the ")" char. I then need to
>> replace the text in that range with a hotlink (easy
enough
>> to do).
>>
>> What I need to know is:
>>
>> 1) How to identify the absolute character position of
the
>> first & last character, and set the RANGE to those
values
>>
>> 2) Is there a different way to do that? If so, how?
>>
>> I'm using vB6.
>>
>> thanks!!
>
>.
>