How do I change the comment default format to include date?

F

frj5000

In Excel 2007, I want to change the default format for comments, so that the
date the comment was added is included in the comment as well as the name of
the user who added the comment.
 
B

Bob Phillips

Don't think that you can, the username is all you get, the rest you add
yourself.
 
C

crimekilla

the link given to contextures.com takes away the signed on user name. i like
the function of it but i need to keep the name of the signed on user that
made the comment. any ideas.
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top