Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

How to compute text width in paragraph

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Hillerson - 23 Jul 2005 03:32 GMT
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.
Jezebel - 23 Jul 2005 05:12 GMT
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.)

> How can I compute the length in inches of a substring in a paragraph?
>
[quoted text clipped - 3 lines]
>
> Any help appreciated.
Gary Hillerson - 25 Jul 2005 06:21 GMT
Thanks so much;it  worked perfectly, it was pretty easy, and I got to
learn about the Information property.

g

>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
[quoted text clipped - 14 lines]
>>
>> Any help appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.