简体   繁体   English

Excel VBA代码打开和关闭注释

[英]excel vba code to turn on and off comments

I am looking for vba code to turn on and off Excel comments - I am using them for online help. 我正在寻找打开和关闭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

It appears you're using a toggle button, in which case you have to check the status of the toggle button before doing anything 看来您正在使用切换按钮,在这种情况下,您必须先检查切换按钮的状态,然后再执行任何操作

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM