#1   Report Post  
Posted to microsoft.public.excel.misc
RKS RKS is offline
external usenet poster
 
Posts: 63
Default comment with date

I can see the code for comment with date and time. its use with MICRO. can it
possible when I insert comment it will display with current date. without
using micro. please tell me how is possible. code which i have thru net is
below;

Sub CommentDateTimeAdd()
'adds comment with date and time,
' positions cursor at end of comment text

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

thanks for advance
RKS

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default comment with date

Maybe...

Excel picks up the username from
Tools|Options|General Tab|under the User Name box.
(xl2003 menu system)

You could go into that dialog each day and change the username to today's date.

If you wanted, you could also use a macro that would change the name to the
current date each time you opened the workbook.

Option Explicit
Sub Auto_Open()
Application.UserName = Format(Date, "mmmm dd, yyyy")
End Sub

But that's using a macro, too.

RKS wrote:

I can see the code for comment with date and time. its use with MICRO. can it
possible when I insert comment it will display with current date. without
using micro. please tell me how is possible. code which i have thru net is
below;

Sub CommentDateTimeAdd()
'adds comment with date and time,
' positions cursor at end of comment text

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

thanks for advance
RKS


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
RKS RKS is offline
external usenet poster
 
Posts: 63
Default comment with date

Thanks its work fine. if we need username+date and time. i dont know about
programming so please change who is required and tell me.

Once again thanks and u people really magician.
RKS

"Dave Peterson" wrote:

Maybe...

Excel picks up the username from
Tools|Options|General Tab|under the User Name box.
(xl2003 menu system)

You could go into that dialog each day and change the username to today's date.

If you wanted, you could also use a macro that would change the name to the
current date each time you opened the workbook.

Option Explicit
Sub Auto_Open()
Application.UserName = Format(Date, "mmmm dd, yyyy")
End Sub

But that's using a macro, too.

RKS wrote:

I can see the code for comment with date and time. its use with MICRO. can it
possible when I insert comment it will display with current date. without
using micro. please tell me how is possible. code which i have thru net is
below;

Sub CommentDateTimeAdd()
'adds comment with date and time,
' positions cursor at end of comment text

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

thanks for advance
RKS


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default comment with date

Option Explicit
Sub Auto_Open()
Dim VbLfPos As Long
Dim myStr As String
myStr = Application.UserName
VbLfPos = InStr(1, myStr, vbLf, vbTextCompare)

'strip out old date
If VbLfPos 0 Then
myStr = Left(myStr, VbLfPos - 1)
End If

myStr = myStr & vbLf & Format(Date, "mmmm dd, yyyy")

Application.UserName = myStr
End Sub


RKS wrote:

Thanks its work fine. if we need username+date and time. i dont know about
programming so please change who is required and tell me.

Once again thanks and u people really magician.
RKS

"Dave Peterson" wrote:

Maybe...

Excel picks up the username from
Tools|Options|General Tab|under the User Name box.
(xl2003 menu system)

You could go into that dialog each day and change the username to today's date.

If you wanted, you could also use a macro that would change the name to the
current date each time you opened the workbook.

Option Explicit
Sub Auto_Open()
Application.UserName = Format(Date, "mmmm dd, yyyy")
End Sub

But that's using a macro, too.

RKS wrote:

I can see the code for comment with date and time. its use with MICRO. can it
possible when I insert comment it will display with current date. without
using micro. please tell me how is possible. code which i have thru net is
below;

Sub CommentDateTimeAdd()
'adds comment with date and time,
' positions cursor at end of comment text

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

thanks for advance
RKS


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting a date from a comment field in an excel file dave Excel Discussion (Misc queries) 3 December 19th 07 08:14 PM
Current date in the comment instead of the user ID Gary[_2_] Excel Worksheet Functions 1 October 22nd 07 11:11 PM
Default date and time in the comment. Gary Excel Worksheet Functions 4 January 16th 07 11:17 PM
Comment Displays date aposatsk Excel Discussion (Misc queries) 8 August 4th 06 12:44 PM
date in cell comment Jack Sons Excel Discussion (Misc queries) 2 July 24th 05 09:55 AM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"