Hi All
I need to calculate string width(NOT length) to determine if it takes
one or more lines.The linked topic below does not meet my
requirement.Anyone please help!

http://groups.google.com/group/microsoft.public.word.vba.general/browse_frm/thread/ed8c125812b59a04/7993922c5d111b10?q=word+vba+calculate+string+width&rnum=2#7993922c5d111b10

Re: how to calculate string width by Jay

Jay
Tue Jan 17 21:21:06 CST 2006

I'm not sure what else you would be looking for beyond what the solution on
the Google groups would give you, but below is a link to a page that has a
download that will get you the text size using the API (you'll need to
register with the site to download the file, but registration is free):

http://www.xtremevbtalk.net/showthread.php?t=125084

Jay Taplin MCP



Re: how to calculate string width by rVo

rVo
Wed Jan 18 05:17:10 CST 2006

If the string is already in a document you could use this trick to figure
out if it's multiline or not...

You position the cursor at the beginning of the string and get the
selection.information(wdFirstCharacterLineNumber)
Next you position the cursor at the end of the string and ask the same
information. If the second value is different from the first one it's
multiline.

But ofcourse using the api is more elegant. Please consider that all pc's
that use your template will need the api installed as well though.

<YiShusen@gmail.com> schreef in bericht
news:1137548500.136862.18920@f14g2000cwb.googlegroups.com...
> Hi All
> I need to calculate string width(NOT length) to determine if it takes
> one or more lines.The linked topic below does not meet my
> requirement.Anyone please help!
>
>
http://groups.google.com/group/microsoft.public.word.vba.general/browse_frm/thread/ed8c125812b59a04/7993922c5d111b10?q=word+vba+calculate+string+width&rnum=2#7993922c5d111b10
>



Re: how to calculate string width by YiShusen

YiShusen
Wed Jan 18 16:54:23 CST 2006

Thank you both. rVo's trick sounds good to me. however, because I
insert the string in a table cell, the
selection.information(wdFirstCharacterLineNumber) behavours different
than I expect. So I need more sugestion, please.