Disable the comments on the shortcut menu

bandit_1981

Board Regular
Joined
Aug 17, 2005
Messages
201
Hello all title says it all. I need to gray them out so no one can use comments. I can gray out the insert but where the edit and delete are not enabled at that time i cant figure out how to gray them out.


Code:
    With CommandBars("Cell")
        .Controls("Insert Comment").Enabled = False
        .Controls("Edit Comment").Enabled = False
        .Controls("Delete Comment").Enabled = False
    End With

This only works for the insert. How can i disable all 3?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

If you cannot Insert comment how can you Edit it? So what you can do is, first delete all the comments, and then run your code, and add an errorhandler which will make the Sub exit.

<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Sub</SPAN> test()
<SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">GoTo</SPAN> errorhandler
<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> ActiveSheet.Comments
    c.Delete
<SPAN style="color:#00007F">Next</SPAN>
<SPAN style="color:#00007F">With</SPAN> CommandBars("Cell")
    .Controls("Delete Comment").Enabled = <SPAN style="color:#00007F">False</SPAN>
     .Controls("Insert Comment").Enabled = <SPAN style="color:#00007F">False</SPAN>
    .Controls("Edit Comment").Enabled = <SPAN style="color:#00007F">False</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
errorhandler:
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top