Excel worksheet cell comment box

D

Donald Stockton

ActiveCell.AddComment
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Text Text:="This is a Test"


The above code will add a comment to the active cell, but how can I also
change the Font properties rather than excel using the default setting?


D.S.
 
T

Tom Ogilvy

Sub E()
ActiveCell.AddComment
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Text Text:="This is a Test"
With ActiveCell.Comment.Shape.TextFrame.Characters.Font
.Name = "Times New Roman"
.Size = 12
.Bold = False
End With

End Sub
 
P

paul.robinson

Hi
Search this Group using
"How do I change the font inside a cell comment"

regards
Paul
 
J

John

Hi Donald,

Have a go with this.

Best regards

John



Sub DonaldsComment()

Dim oCmt As Comment

'Set reference to new comment
Set oCmt = ActiveCell.AddComment

'Set visibility & text
oCmt.Visible = False
oCmt.Text "This is a test"

'Set font
With oCmt.Shape.TextFrame.Characters.Font
.Name = "Arial"
.Size = 10
.Bold = False
End With

'Set comment size
With oCmt.Shape
.Width = 100
.Height = 100
End With

End Sub
 
D

D.S.

Thanks to all


John said:
Hi Donald,

Have a go with this.

Best regards

John



Sub DonaldsComment()

Dim oCmt As Comment

'Set reference to new comment
Set oCmt = ActiveCell.AddComment

'Set visibility & text
oCmt.Visible = False
oCmt.Text "This is a test"

'Set font
With oCmt.Shape.TextFrame.Characters.Font
.Name = "Arial"
.Size = 10
.Bold = False
End With

'Set comment size
With oCmt.Shape
.Width = 100
.Height = 100
End With

End Sub
 
D

D.S.

One more question about the comment box....

Can it be sized? for instance, can I size it to fit the contents?
 
P

paul.robinson

Hi
Try searching this group using "can I size a comment box to fit the
contents"

regards
Paul
 
P

ph8

With Range("A1")
..addComment ("This is my sized comment")
..Comment.Shape.Height = 11
..Comment.Shape.Width = 123
End With
 

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

Top