ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comment (https://www.excelbanter.com/excel-programming/286018-comment.html)

Jack

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

Amit Shanker

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




Amit Shanker

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.




Beto[_3_]

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.


Jack

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



.


Debra Dalgleish

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


Robbyn[_2_]

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

Robbyn

Debra Dalgleish

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


Dave Peterson[_3_]

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



All times are GMT +1. The time now is 12:04 PM.

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