ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding cell comment via VBA (bold font?) (https://www.excelbanter.com/excel-programming/393840-adding-cell-comment-via-vba-bold-font.html)

Greg

adding cell comment via VBA (bold font?)
 
Hi,

Is there a way to make part of a cell comment bold (user name in particular)
when a comment is being added via VBA?

Thanks,
--
______
Regards,
Greg

Anony

adding cell comment via VBA (bold font?)
 
To change the comment text to bold:
ActiveCell.Comment.Shape.TextFrame.Characters.Font .Bold = True


"Greg" wrote:

Hi,

Is there a way to make part of a cell comment bold (user name in particular)
when a comment is being added via VBA?

Thanks,
--
______
Regards,
Greg


Greg

adding cell comment via VBA (bold font?)
 
how about only part of the comment?

for instant:
John Smith:
this cell has a comment


--
______
Regards,
Greg


"Anony" wrote:

To change the comment text to bold:
ActiveCell.Comment.Shape.TextFrame.Characters.Font .Bold = True


"Greg" wrote:

Hi,

Is there a way to make part of a cell comment bold (user name in particular)
when a comment is being added via VBA?

Thanks,
--
______
Regards,
Greg


Anony

adding cell comment via VBA (bold font?)
 
I'm using the Application.UserName here, but the principle's the same. Go by
character lengths:

Sub FormatCmt()
Dim Cmt As Comment
Dim YourName As String
Dim Text As String

Text = "Here's your comment."
With ActiveCell
YourName = Application.UserName & ":" & vbLf
Set Cmt = .AddComment(YourName & Text)
With Cmt.Shape.TextFrame
.Characters.Font.Bold = False
.Characters(1, Len(YourName)).Font.Bold = True
End With
End With
End Sub

-----------------
Cheers,
Anony


All times are GMT +1. The time now is 03:13 PM.

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