The code takes away the Application Usename found in General Options, not
the signed on user name which could be different.
See revisions in this macro.
Sub CommentDateTimeAdd()
'adds Excel comments with date and time,
' positions cursor at end of comment text
'
www.contextures.com\xlcomments03.html
Dim strDate As String
Dim cmt As Comment
strDate = "dd-mmm-yy hh:mm:ss"
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.Text Text:=Environ("username") & ":" & Chr(10) & _
Format(Now, strDate) & Chr(10)
Else
cmt.Text Text:=Environ("username") & ":" & Chr(10) & _
Format(Now, strDate) & Chr(10)
End If
With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With
SendKeys "%ie~"
End Sub
Gord