判断EXCEL某一单元格中注释是否存在的问题,也许是因为VBA本身没有提供Comment.Exists类似的方法,所以以为该问题解决起来可能会非常麻烦.
晚上回去躺在床上,忽然一个想法冒了出来,用   object is nothing来判断一下,看看行不行.今早一试,果然是应该这样来判断.  
其实昨天我就用这个试过的,只是当时忘了vb中判断某一对象是否为nothing需要用is而不是=.
 
具体编码如下:
 If Not mSheet.Cells(rowIndex, colIndex).comment Is Nothing Then
        mSheet.Cells(rowIndex, colIndex).comment.Delete
        mSheet.Cells(rowIndex, colIndex).AddComment (errorText)
    Else
         mSheet.Cells(rowIndex, colIndex).AddComment (errorText)
    End If
posted on 2008-08-20 09:02  是谁啊?  阅读(3200)  评论(0编辑  收藏  举报