How can I compute the length in inches of a substring in a paragraph?

I need a function that takes a Paragraph object, and a string that's
part of the text of that paragraph, and tells me whether the string's
width in the document is more than 1/4 inch.

Any help appreciated.

Re: How to compute text width in paragraph by Jezebel

Jezebel
Fri Jul 22 23:12:53 CDT 2005

There's no Word function that does this directly, but you could do it using
the Information() function: set a Range to point to your substring, then
check the horizontal position --

MyRange.Information(wdHorizontalPositionRelativeToPage)

Now make a Range that starts immediately after your substring and check its
position: the width of your substring is the difference between the two,
provided you're still on the same line. (You can check the vertical position
to confirm that.)





"Gary Hillerson" <garyh@hillysun.net> wrote in message
news:spa3e1p3up5c46qgoo7r5aisp5cbs72gce@4ax.com...
> How can I compute the length in inches of a substring in a paragraph?
>
> I need a function that takes a Paragraph object, and a string that's
> part of the text of that paragraph, and tells me whether the string's
> width in the document is more than 1/4 inch.
>
> Any help appreciated.



Re: How to compute text width in paragraph by Gary

Gary
Mon Jul 25 00:21:13 CDT 2005

Thanks so much;it worked perfectly, it was pretty easy, and I got to
learn about the Information property.

g


On Sat, 23 Jul 2005 13:42:53 +0930, "Jezebel"
<warcrimes@whitehouse.gov> wrote:

>There's no Word function that does this directly, but you could do it using
>the Information() function: set a Range to point to your substring, then
>check the horizontal position --
>
>MyRange.Information(wdHorizontalPositionRelativeToPage)
>
>Now make a Range that starts immediately after your substring and check its
>position: the width of your substring is the difference between the two,
>provided you're still on the same line. (You can check the vertical position
>to confirm that.)
>
>
>
>
>
>"Gary Hillerson" <garyh@hillysun.net> wrote in message
>news:spa3e1p3up5c46qgoo7r5aisp5cbs72gce@4ax.com...
>> How can I compute the length in inches of a substring in a paragraph?
>>
>> I need a function that takes a Paragraph object, and a string that's
>> part of the text of that paragraph, and tells me whether the string's
>> width in the document is more than 1/4 inch.
>>
>> Any help appreciated.
>