vba 如何检索单元格注释的文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24921051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I retrieve the text of a cell comment
提问by gssi
I find lots of examples for creating but none for retrieving the text of a cell comment. Am I missing something obvious?
我找到了很多用于创建的示例,但没有用于检索单元格注释文本的示例。我错过了一些明显的东西吗?
回答by KekuSemau
Range.Comment.Text
seems to work without any problem here...
Range.Comment.Text
似乎在这里工作没有任何问题......
(e. g. if not ActiveCell.Comment is nothing then debug.print ActiveCell.Comment.Text
)
(例如if not ActiveCell.Comment is nothing then debug.print ActiveCell.Comment.Text
)
回答by Rafa? Tulisz
Try going for:
尝试去:
Dim comtext as string
If ActiveCell.Comment Is Nothing Then
comtext = ""
Else
comtext = ActiveCell.Comment.Text
End If
As for me, if you want to paste comment text as other cell value you might need to use:
至于我,如果您想将评论文本粘贴为其他单元格值,您可能需要使用:
Selection.ClearFormats
Selection.ClearFormats
since sometimes comment text which you pasted or set cell value might be invisible at first.
因为有时您粘贴或设置单元格值的注释文本一开始可能不可见。
PS. This is my first post ever on this side, so I've just started learning the ropes.
附注。这是我在这方面的第一篇文章,所以我刚刚开始学习绳索。