Is there any sort of autosize for Comments

User avatar
Goshute
3StarLounger
Posts: 397
Joined: 24 Jan 2010, 19:43
Location: Salt Lake City, Utah, USA

Is there any sort of autosize for Comments

Post by Goshute »

For some reason, probably hiding columns which the comment text displayed over, a bunch of comment boundaries got minimized. I was able to build this to fix it:

Code: Select all

Sub ReSizeComments()
  Dim intC As Integer
  
  For intC = 1 To ActiveSheet.Comments.Count
    With ActiveSheet.Comments(intC).Shape
      .Height = 60
      .Width = 96
    End With
  Next intC
End Sub
But is there a way to autosize Comments to the text in them?
Last edited by Goshute on 07 Apr 2011, 21:31, edited 1 time in total.
Goshute
I float in liquid gardens

User avatar
rory
5StarLounger
Posts: 818
Joined: 24 Jan 2010, 15:56

Re: Is there any sort of autosize for Comments

Post by rory »

Yep - you need to add:

Code: Select all

.Textframe.Autosize = True
Regards,
Rory

User avatar
Goshute
3StarLounger
Posts: 397
Joined: 24 Jan 2010, 19:43
Location: Salt Lake City, Utah, USA

Re: Is there any sort of autosize for Comments

Post by Goshute »

:thumbup: Nice, but some of my comments are longish and Autosize doesn't text wrap - I have to go in and use Ctrl-Enter to get line breaks to force Autosize with text wrap (Office 2010).
Goshute
I float in liquid gardens

User avatar
rory
5StarLounger
Posts: 818
Joined: 24 Jan 2010, 15:56

Re: Is there any sort of autosize for Comments

Post by rory »

How would it autosize otherwise? :)
Regards,
Rory

User avatar
Goshute
3StarLounger
Posts: 397
Joined: 24 Jan 2010, 19:43
Location: Salt Lake City, Utah, USA

Re: Is there any sort of autosize for Comments

Post by Goshute »

Now I gotta write a word wrap function for Comment text. :crybaby: Life is hard. :wink:
Goshute
I float in liquid gardens

Rick Rothstein
Microsoft MVP
Posts: 87
Joined: 10 Mar 2011, 05:38
Status: Microsoft MVP
Location: New Jersey in the US

Re: Is there any sort of autosize for Comments

Post by Rick Rothstein »

rory wrote:How would it autosize otherwise? :)
I would think it could do it just like a cell with wordwrap enabled does it... autosize the height while retaining the existing (or possibly a specifically specified) width.

User avatar
sdckapr
3StarLounger
Posts: 392
Joined: 25 Jan 2010, 12:21

Re: Is there any sort of autosize for Comments

Post by sdckapr »

I would think it could do it just like a cell with wordwrap enabled does it... autosize the height while retaining the existing (or possibly a specifically specified) width.
It could, but unfortunately it does not. Like Text boxes it only has autofit, not autofit ht given width or autofit width given ht. As far as I can see, that functionality would have to be user-created and (as you probably can imagine) it is not a trivial task...

Steve