View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I change the comment default format to include date?

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




On Mon, 10 May 2010 07:12:04 -0700, crimekilla
wrote:

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.

"Gord Dibben" wrote:

You cannot change the default.

You can run a macro to insert a Comment with date and time.

See Debra Dalgleish's site for code.

http://www.contextures.on.ca/xlcomments03.html#DateTime


Gord Dibben MS Excel MVP

On Mon, 22 Mar 2010 15:57:01 -0700, frj5000
wrote:

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.


.