Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default 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.


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
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
Convert cell "contents" into a "comment" Ryan Excel Discussion (Misc queries) 4 October 3rd 08 11:34 PM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


All times are GMT +1. The time now is 10:19 PM.

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

About Us

"It's about Microsoft Excel"