Autosize for comment in a Shape

geracole

New Member
Joined
Mar 29, 2016
Messages
1
Hi,

I add comment in tooltip for a shape with hyperlink.
The size of the tolltip is fixed an unfortunatelly too small.
How to set Autosize for this comment or set the real height ?

Code:
Sub AddComm()
Dim Sh As Shape
Dim txt As String
Dim i As Integer
    On Error Resume Next
    ActiveSheet.Shapes("Carre").Cut
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 43.5, 27#, 53.25, 48.75). _
        Select
    Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
    Selection.Name = "Carre"
    For i = 1 To 20
        txt = txt & "abcdefgh" & i & Chr(10)
    Next
    ActiveSheet.Hyperlinks.Add Anchor:=Selection.ShapeRange.Item(1), Address:= _
    "", SubAddress:="Feuil1!A1", ScreenTip:=txt
    [A1].Select
 End Sub
I know how to change a Cell comment but it doesn't work with shape
Code:
[COLOR=#408000][FONT=Segoe UI]Cells(noLig, 6).Comment.Shape.Select[/FONT][/COLOR]
[COLOR=#408000][FONT=Segoe UI]Selection.ShapeRange.ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft[/FONT][/COLOR]
[COLOR=#408000][FONT=Segoe UI]Selection.ShapeRange.ScaleHeight 4, msoFalse, msoScaleFromTopLeft[/FONT][/COLOR]

You must know that this comment isn't found in a loop like
Code:
Public Sub Comments_AutoSize()
Dim Cmt As Comment
Dim lHeight As Long
    For Each Cmt In ActiveSheet.Comments
        With Cmt
            .Shape.TextFrame.AutoSize = True
        End With
    Next Cmt
End Sub

Who can help me ?
Thanks.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top