ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format comment username (https://www.excelbanter.com/excel-programming/286537-format-comment-username.html)

Bill[_19_]

Format comment username
 
I want a macro that has Note: instead of username, in bold
and then pauses for the rest of the text.
From www.contextures.com I found.

Sub CommentAddOrEdit()
'adds new plain text comment or positions
'cursor at end of existing comment text
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment text:="Note: "
End If
SendKeys "%ie~"
End Sub

But how do I make the Note: bold and reset to normal for
text input.

Thanks

Dave Peterson[_3_]

Format comment username
 
A slight change to Debra's code:

Option Explicit

Sub CommentAddOrEdit()

Dim cmt As Comment

Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:="Note: "
Set cmt = ActiveCell.Comment
With cmt.Shape.TextFrame.Characters(Start:=1, Length:=6).Font
.Bold = True
End With
End If
SendKeys "%ie~"

End Sub


Bill wrote:

I want a macro that has Note: instead of username, in bold
and then pauses for the rest of the text.
From www.contextures.com I found.

Sub CommentAddOrEdit()
'adds new plain text comment or positions
'cursor at end of existing comment text
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment text:="Note: "
End If
SendKeys "%ie~"
End Sub

But how do I make the Note: bold and reset to normal for
text input.

Thanks


--

Dave Peterson



All times are GMT +1. The time now is 02:55 PM.

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