PDA

View Full Version : Hide comments programmatetically



antonf
10-28-2009, 09:17 PM
Thanks to XLD and Lenze I now have exactly what I want in my "comment track changer" code.

I would now like to disable the facility to add comments in the worksheet and hide the comments automatically added when changes were made. Is it possible to have a facility whereby a password is required to view all the comments in this sheet?

Thanks a lot!

MWE
10-29-2009, 06:36 PM
Thanks to XLD and Lenze I now have exactly what I want in my "comment track changer" code.

I would now like to disable the facility to add comments in the worksheet and hide the comments automatically added when changes were made. Is it possible to have a facility whereby a password is required to view all the comments in this sheet?

Thanks a lot!
An interesting problem. Playing with Comment visibility or Comment shape visibility works until the cursor moves over the comment cell. But here is an awkward approach that might help. It does not hide the comment completely but it does hide the box in which the comment text is displayed and might get you started on another line of thought:

Sub HideComments()

Dim Cmt As Comment

MsgBox "# comments = " & ActiveSheet.Comments.Count
For Each Cmt In ActiveSheet.Comments
MsgBox Cmt.Text
Cmt.Shape.Width = 0
Cmt.Shape.Height = 0
Next Cmt

End Sub I suspect that with a few more minutes to play around I could find something better.