我正在寻找打开和关闭Excel评论的vba代码 - 我正在使用它们进行在线帮助。
Sub CommentsToggle_Click()
If Help.Caption = "HELP" Then
'If IsEmpty(Comments) = True Then
Application.DisplayCommentIndicator = xlCommentAndIndicator
Help.Caption = "HIDE COMMENTS"
Else
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
' Comments = 1
End If
End Sub
答案 0 :(得分:0)
您似乎正在使用切换按钮,在这种情况下,您必须在执行任何操作之前检查切换按钮的状态
Sub CommentsToggle_Click()
If CommentsToggle.Value = True Then 'The toggle button is pressed
Application.DisplayCommentIndicator = xlCommentAndIndicator
Help.Caption = "HIDE COMMENTS"
Else 'The toggle button is depressed :(
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
Help.Caption = "HELP"
End If
End Sub