View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 163
Default Finding the length of proportional text strings

Hi Russ

I don't think there is much else you can do.
Even if some api functions like GetTextMetrics
which i am not familiar with,
would tell you how wide your text is,
you still would have to calculate the maximum width beforehand,
get the width of a space
und add as many spaces at once to get the perfect width.

I even doubt, whether adding spaces the way you do in Excel,
will always show the desired effect in Word.
Does it? Then I have once again learned something.

How about leaving it all to Word.
Wouldn't be any more elegant, though,
but then you would know, whether the text fits
according to Word's way of calculating it.

In Word you would use Range.ComputeStatistics(wdStatisticLines).
But, i'm sure, there was no need of telling you that.

Have a nice day.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"