View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Anthony Berglas[_2_] Anthony Berglas[_2_] is offline
external usenet poster
 
Posts: 4
Default Autosize bug in Excel 2007 shape textframes

Good idea, but I just tried it and no, that does not work.

The behavior for comment frames seems slightly different to text boxes,
still investigating.

If anyone knows how to write a WidthOfFontedString(characters) then that
would be great.

(And I have set up a "real" news reader, apologies for the multiple
posts. And all the messages now show up on Google. But not in the
search index. I must have just missed them when I checked this morning.)

Thanks,

Anthony

NickHK wrote:

Anthony,
I don't use XL2007, but does it jog the Text frame to the correct size if
you toggle the AutoSize property:

With <YourTextFrame
.Characters.Text = "Some long line of text spread" & Chr(10) & "over
several" & Chr(10) & "lines"
.AutoSize=false
.AutoSize=true
End with

NickHK

"Anthony Berglas" wrote in message
oups.com...

XL 2007 only seems to AutoSize the Height of a text box, not the
Width.
This is different from XL 95..2003 which autosized both.

This is easily seen from the UI, just create an Autoboxed frame and
type into it, only in XL < 2007 does it get wider.

This makes it difficult to programatically create a text box, and put
some text in it and have the box displayed in a natural width. Same
goes for comments etc.

Any ideas for a work around most appreciated. (Guessing the width of
fonted strings is very error prone.)

Regards,

Anthony