#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Comment

Hi...

I'm trying to create a macro button that will insert
and/or delete a comment within the active cell without any
access to the menu toolbars.

Also, how can i disable the right click in a workbook?

Thanks if anyone can help me.

Jack
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Comment

Hi Jack,

For comments :

Sub AddOrDeleteComment()
Dim cmt As Comment

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment "This is a new comment"
Else
ActiveCell.Comment.Delete
End If

End Sub

For disabling right-click :
Application.CommandBars("Cell").Enabled = False

Amit
"Jack" wrote in message
...
Hi...

I'm trying to create a macro button that will insert
and/or delete a comment within the active cell without any
access to the menu toolbars.

Also, how can i disable the right click in a workbook?

Thanks if anyone can help me.

Jack



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Comment

You are right, it's not needed. I was trying code in a different way before
posting and it simply got left there !!

Amit


"Beto" wrote in message
...
Amit Shanker wrote:

For comments :

Sub AddOrDeleteComment()
Dim cmt As Comment

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment "This is a new comment"
Else
ActiveCell.Comment.Delete
End If

End Sub

Hi, do you need the "Dim cmt as Comment"? Because I can't see where it's
used.

As for the Right Click, you can set Cancel to True in the
BeforeRightClickEvent of the Workbook.

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Comment

Amit Shanker wrote:

For comments :

Sub AddOrDeleteComment()
Dim cmt As Comment

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment "This is a new comment"
Else
ActiveCell.Comment.Delete
End If

End Sub

Hi, do you need the "Dim cmt as Comment"? Because I can't see where it's
used.

As for the Right Click, you can set Cancel to True in the
BeforeRightClickEvent of the Workbook.

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Comment

Hi...

Thanks for your help. I noticed that the code you wrote
puts a comment into the active cell but doesn't allow it
to be edited. What would be good is for a comment box to
be pop up awaiting input.

Thanks in advance...

Gordon...

-----Original Message-----
Hi Jack,

For comments :

Sub AddOrDeleteComment()
Dim cmt As Comment

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment "This is a new comment"
Else
ActiveCell.Comment.Delete
End If

End Sub

For disabling right-click :
Application.CommandBars("Cell").Enabled = False

Amit
"Jack" wrote in

message
...
Hi...

I'm trying to create a macro button that will insert
and/or delete a comment within the active cell without

any
access to the menu toolbars.

Also, how can i disable the right click in a workbook?

Thanks if anyone can help me.

Jack



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Comment

There are some code samples he

Insert a Plain Comment
http://www.contextures.com/xlcomments03.html#Plain

Jack wrote:
Thanks for your help. I noticed that the code you wrote
puts a comment into the active cell but doesn't allow it
to be edited. What would be good is for a comment box to
be pop up awaiting input.

-----Original Message-----

Sub AddOrDeleteComment()
Dim cmt As Comment

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment "This is a new comment"
Else
ActiveCell.Comment.Delete
End If

End Sub

For disabling right-click :
Application.CommandBars("Cell").Enabled = False

Amit
"Jack" wrote in


message

...

Hi...

I'm trying to create a macro button that will insert
and/or delete a comment within the active cell without


any

access to the menu toolbars.

Also, how can i disable the right click in a workbook?


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Comment

Hi Debra. I checked out your code for comments and am wondering what 'SendKeys "%ie~" does?

Robbyn
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Comment

Used with the SendKeys statement, % represents the Alt key, and ~
represents the Enter key.

When a cell that contains a comment is selected, it's like pressing
Alt+I (to open the Insert menu), then E (to highlight Edit Comment),
then pressing the Enter key to activate the command.

Robbyn wrote:
Hi Debra. I checked out your code for comments and am wondering what 'SendKeys "%ie~" does?

Robbyn



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Comment

Sendkeys "types" those characters

Select a cell with a comment in it.
hit alt-i (insert from the worksheet menubar)
(alt is represented by %)
e (accellerator key for Edit Comment (notice the underline)
~ (sends an enter key)



Robbyn wrote:

Hi Debra. I checked out your code for comments and am wondering what 'SendKeys "%ie~" does?

Robbyn


--

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
Comment box Chiefgarcia Excel Worksheet Functions 7 February 19th 09 12:50 AM
copy comment content to cell content as data not as comment Lilach Excel Discussion (Misc queries) 2 June 21st 07 12:28 PM
How can I edit a comment w/o first having to select Show Comment Mary Ann Excel Discussion (Misc queries) 1 August 26th 05 12:34 AM
How do I insert a comment when the Insert:Comment menu is greyed? none Excel Discussion (Misc queries) 0 May 19th 05 12:36 AM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM


All times are GMT +1. The time now is 04:03 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"