Comment with date stamp

K

Keyrookie

Hello all,

I copied these macros from the "Contextures" site but I would like som
help. I've already run the this macro:

Sub CommentNote()
Application.UserName = "Note"
End Sub


...but I would like to also have a automatic time stamp in the commen
as well. I can run the following macro but the comment only shows th
time, not the above "Note" and you have to run the macro for the tim
to show.


To insert a comment with the current date and time, or append th
current date and time to an existing comment, use the following macro:

Sub CommentDateTimeAdd()
'adds comment 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:=Format(Now, strDate) & Chr(10)
Else
cmt.text text:=cmt.text & Chr(10) _
& Format(Now, strDate) & Chr(10)
End If

With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With

SendKeys "%ie~"

End Sub



I'm wanting to have comments look like this:

12-8-09 10:30 AM (whatever the date & time was upon "Inser
Comment")
Note:



Thanks in advance,
 

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