Code below inserts a comment into cell, colors it blue - works fine to that point, but when I try to set font properties it gives .Font - invalid use of property error
Can someone edit this code so it works (want font color white too
Code below inserts a comment into cell, colors it blue - works fine to that point, but when I try to set font properties it gives .Font - invalid use of property error
Can someone edit this code so it works (want font color white too
Hello,
You can dive into all the intricacies of cells' comments thanks to Debra's excellent site :
https://www.contextures.com/xlcomments03.html
Hope this will help
You need something like this
Option Explicit
Sub CommentAndColor()
Dim comtemp As Comment
Set comtemp = ActiveCell.AddComment
With comtemp
.Text Text:="Hello World"
.Shape.Width = 230
.Shape.Height = 110
.Shape.AutoShapeType = msoShapeRoundedRectangle
.Shape.Fill.ForeColor.RGB = RGB(58, 82, 184)
.Shape.Fill.OneColorGradient msoGradientDiagonalUp, 1, 0.23
.Shape.TextFrame.Characters.Font.Name = "Tahoma"
.Shape.TextFrame.Characters.Font.Bold = False
.Shape.TextFrame.Characters.Font.Size = 11
.Shape.TextFrame.Characters.Font.ColorIndex = 2
.Shape.Fill.Visible = msoTrue
.Visible = True
End With
End Sub
Display More
Don’t have an account yet? Register yourself now and be a part of our community!