📜  excel vba 检查密钥是否在集合中 - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:55.282000             🧑  作者: Mango

代码示例1
'A Dictionary is a better choice when you need to determine if a key 
'is already in the collection. But here is a VBA function that
'reports True or False for Collections:

Function KeyExists(key$, c As Collection)
  On Error Resume Next
  c.Item key
  KeyExists = Err = 0: Err.Clear
End Function

'--------------------------------------------------------------------

MsgBox KeyExists("Netflix", colFANG)