ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro handling "Insert comment" (https://www.excelbanter.com/excel-programming/404041-macro-handling-insert-comment.html)

KP[_3_]

Macro handling "Insert comment"
 
Hi,

Can someone help me to write a macro doing the following:

When I click "Insert comment", I want the date and time to be standard in
the comment box just below the first default line with the username.

I want it to be available already when I open the file without having to run
the macro manually or by keyboard selection.

In addition, is it possible - in the same macro - to change the first line
with username from bold to plain text.

Thanks
K. Pedersen



Ron de Bruin

Macro handling "Insert comment"
 
See Debra's site
http://www.contextures.com/xlcomments03.html

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"KP" wrote in message ...
Hi,

Can someone help me to write a macro doing the following:

When I click "Insert comment", I want the date and time to be standard in
the comment box just below the first default line with the username.

I want it to be available already when I open the file without having to run
the macro manually or by keyboard selection.

In addition, is it possible - in the same macro - to change the first line
with username from bold to plain text.

Thanks
K. Pedersen



KP[_3_]

Macro handling "Insert comment"
 
Hi Ron de Bruin,
I was already aware of the suggested site but I have not found out how to
use the proposal given there.
It seems as if you have to add a toolbar button or shortcut key to run it
and that is not what I want.

I still hope that you or somebody else can help.

Regards
K. Pedersen



"Ron de Bruin" skrev i en meddelelse
...
See Debra's site
http://www.contextures.com/xlcomments03.html

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"KP" wrote in message
...
Hi,

Can someone help me to write a macro doing the following:

When I click "Insert comment", I want the date and time to be standard in
the comment box just below the first default line with the username.

I want it to be available already when I open the file without having to
run the macro manually or by keyboard selection.

In addition, is it possible - in the same macro - to change the first
line with username from bold to plain text.

Thanks
K. Pedersen




Gord Dibben

Macro handling "Insert comment"
 
You want this on the right-click Insert Comment or on the Worksheet menu
InsertComment?

To have it on the Worksheet Menu InsertComment just use this revised macro
from Debra.

ToolsCustomize.

Select Insert on menu and right-click on Comment and assign macro.

Sub CommentDateTimeAdd()
'adds comment with date and time and username

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:=Application.UserName & Chr(10) _
& 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

End Sub

To add the macro to the right-click menu...............

Add this to Thisworkbook module

Private Sub Workbook_Open()
With Application.CommandBars("Cell").Controls("Insert Comment")
.OnAction = "Allskeds.xls" & "!CommentDateTimeAdd"
End With
End Sub

If you want to reset the right-click menu..........

Sub reset()
Application.CommandBars("Cell").Controls("Insert Comment").reset
End Sub


Gord Dibben MS Excel MVP


On Thu, 10 Jan 2008 21:40:34 +0100, "KP" wrote:

Hi Ron de Bruin,
I was already aware of the suggested site but I have not found out how to
use the proposal given there.
It seems as if you have to add a toolbar button or shortcut key to run it
and that is not what I want.

I still hope that you or somebody else can help.

Regards
K. Pedersen



"Ron de Bruin" skrev i en meddelelse
...
See Debra's site
http://www.contextures.com/xlcomments03.html

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"KP" wrote in message
...
Hi,

Can someone help me to write a macro doing the following:

When I click "Insert comment", I want the date and time to be standard in
the comment box just below the first default line with the username.

I want it to be available already when I open the file without having to
run the macro manually or by keyboard selection.

In addition, is it possible - in the same macro - to change the first
line with username from bold to plain text.

Thanks
K. Pedersen




Jialiang Ge [MSFT]

Macro handling "Insert comment"
 
Hello

From your post, my understanding on this issue is: you wonder how to
customize the initial comment content when users click on "Insert Comment"
button. If I'm off base, please feel free to let me know.

Excel does not expose any event for the action of entering the "Comment"
mode. If it had such an event, we would be able to register it and
customize the "insert comment" action.

As Gord suggested, the workaround is to assign a custom macro to all the
"Insert Comment" buttons, and replace the default insertion action. Apart
from the "Insert Comment" button on the "Insert" menu and worksheet context
menu, I think we also need to assign it to the "Insert Comment" on the
"Reviewing" toolbar:
1. Right click the Excel toolbar and check "Reviewing".
2. Tools-Customize, right click the "Insert Comment" button on the
toolbar, and assign the macro

Hope it helps.

If you have any other concerns or need anything else, please feel free to
let us know.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com