I need to test if the Item of a VBA Dictionary is equal to a given value, without adding a new key and value to the dictionary.
dict.RemoveAll
MsgBox dict.Exists(key)
MsgBox dict.Exists(key) returns false, the dict is empty.
var = "Hello"
MsgBox var = dict(key)
The MsgBox returns false, because var and the item returned by dict(key) is not equal. But when I again check if the key exists in the dictionary, dict.Exists(key) now returns true.
MsgBox dict.Exists(keys)
Seems to me the equal-Operator not only compares var with the item, but also assigns a new key and item pair to the dict, but i need the dictionary still to be empty. How can i achieve this?