comments AutoSize

  • Thread starter Thread starter CG Rosén
  • Start date Start date
C

CG Rosén

Hi Group,

Has tried to find an answer on this problem in Goggles without result.
Has code as below. Works fine, but the Comment TextFrame shows
a blank line before the text. This make the Comment Frame a rectangel
with the text always at the bottom. Is it possible to remove this blank
line by VBA to get the text in the first line of the AutoSized TextFrame?
(The text is supposed to be a date in the format: dd mmm)

Thankful for any hints.

Brgds

CG Rosén
-----------------------------------------------------

With ActiveCell.AddComment
.Visible = False
.Text Text:= _
Chr(10) & " text"

With ActiveCell.Comment.Shape.TextFrame
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.AutoSize = True

End With
End With
 
Hi CG Rosén,

You need to remove Chr(10) before your text.

Use:

With ActiveCell.AddComment
.Visible = False
.Text Text:= "your text"

With ActiveCell.Comment.Shape.TextFrame
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.AutoSize = True

End With
End With


Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top