ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Comment in Current Call and set then width (https://www.excelbanter.com/excel-programming/434121-insert-comment-current-call-set-then-width.html)

moonhk[_2_]

Insert Comment in Current Call and set then width
 
Hi All
How to Insert Comment in Current Call and set then width.
below is records macro generate coding
How to programming ?

My coding stop at .Shape.Select.

Sub InsertComment()
With Cells(ActiveCell.Row, ActiveCell.Column)
.AddComment
.Comment.Visible = True
.Shape.Select
.ShapeRange.ScaleWidth 5.05, msoFalse, msoScaleFromBottomRight
.ShapeRange.ScaleWidth 1.24, msoFalse, msoScaleFromTopLeft
.Comment.Shape.Select True
End With

End Sub


Sub Macro1()
'

Range("S19").AddComment
Range("S19").Comment.Visible = False
Range("S19").Comment.Text Text:="e:" & Chr(10) & ""
Selection.ShapeRange.ScaleWidth 5.05, msoFalse,
msoScaleFromBottomRight
Selection.ShapeRange.ScaleWidth 1.24, msoFalse,
msoScaleFromTopLeft
Range("S19").Comment.Shape.Select True
Range("S19").Comment.Text Text:="e:" & Chr(10) & "zxdfdf"
Range("S23").Select
End Sub

Mike H

Insert Comment in Current Call and set then width
 
Hi,

Try this

Sub AddAndSizeComment()
Dim ComBox As Comment
ActiveCell.AddComment
Set ComBox = ActiveCell.Comment
With ComBox
..Text Text:="My Comment text"
..Visible = True
..Shape.ScaleWidth 2.5, msoFalse, msoScaleFromBottomRight
..Shape.ScaleHeight 3.1, msoFalse, msoScaleFromBottomRight
End With
Set ComBox = Nothing
End Sub

Mike

"moonhk" wrote:

Hi All
How to Insert Comment in Current Call and set then width.
below is records macro generate coding
How to programming ?

My coding stop at .Shape.Select.

Sub InsertComment()
With Cells(ActiveCell.Row, ActiveCell.Column)
.AddComment
.Comment.Visible = True
.Shape.Select
.ShapeRange.ScaleWidth 5.05, msoFalse, msoScaleFromBottomRight
.ShapeRange.ScaleWidth 1.24, msoFalse, msoScaleFromTopLeft
.Comment.Shape.Select True
End With

End Sub


Sub Macro1()
'

Range("S19").AddComment
Range("S19").Comment.Visible = False
Range("S19").Comment.Text Text:="e:" & Chr(10) & ""
Selection.ShapeRange.ScaleWidth 5.05, msoFalse,
msoScaleFromBottomRight
Selection.ShapeRange.ScaleWidth 1.24, msoFalse,
msoScaleFromTopLeft
Range("S19").Comment.Shape.Select True
Range("S19").Comment.Text Text:="e:" & Chr(10) & "zxdfdf"
Range("S23").Select
End Sub



All times are GMT +1. The time now is 07:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com