Hi,
If you record a macro whilst adding comments you will see that the username is added rather than appearing by default. So you have to do the same.
This will add the header text in bold and then append what extra text is specified.
VB:Sub Test() MyAddComment Range("A1"),"Hello World" End Sub Sub MyAddComment(ToCell As Range, Text As String) Dim objComment As Comment Dim strHeader As String With ToCell strHeader = Application.UserName & ":" & vbLf Set objComment = .AddComment(strHeader & Text) With objComment.Shape.TextFrame .Characters.Font.Bold = False .Characters(1, Len(strHeader)).Font.Bold = True End With End With End Sub


in advance
Reply With Quote
Bookmarks