我需要在 VBA 中有两个字典,我想检查第二个字典中是否存在第一个字典中的一项。我尝试了下面的代码,但没有找到该项目。仅出现消息“不存在”。有人可以帮忙吗?
Sub Dict()
Dim Tuna As Scripting.Dictionary
Set Tuna = New Scripting.Dictionary
Dim Pako As Scripting.Dictionary
Set Pako = New Scripting.Dictionary
Tuna.Add "01", "first"
Tuna.Add "02", "second"
Pako.Add "01", "first"
If Tuna.Exists(Pako.Items(0)) = True Then
MsgBox ("exists")
Else
MsgBox ("not exists")
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
问候