出于某种原因,我无法将CompareMode
字典offONameDic
中的TextCompare
. 我不断得到一个"Invalid Procedure or Call Error"
. 我想确保用户提供的密钥的大写不会影响字典将密钥识别为有效的能力,即如果密钥是“hello”,“Hello”也将被识别为密钥。
请注意,我使用 VBA Excel 中已安装库列表中的 Microsoft 脚本运行时参考
我的代码:
Sub Main()
'...code...
Dim offONameDic As Scripting.Dictionary
'...code...
Set offONameDic = New Scripting.Dictionary
With offONameDic
.Add "Blood", "Blood"
.Add "Liver", "Liver"
.Add "Kidneys", "Kidneys"
.Add "Kidney", "Kidneys"
.Add "Spleen", "Spleen"
.Add "Heart", "Heart"
.Add "Lungs", "Lungs"
.Add "Lung", "Lungs"
.Add "Stomach", "Stomach"
.Add "Muscle", "Muscle"
.Add "Bone", "Bone"
.Add "Carcass", "Carcass"
.Add "Tumor", "Tumor"
.Add "Axial Lymph Node", "Axial Lymph Node"
.Add "ALN", "Axial Lymph Node"
.Add "Igunial Lymph Node", "Igunial Lymph Node"
.Add "IgLN", "Igunial Lymph Node"
.Add "Intestines", "Intestines"
.Add "Intestine", "Intestines"
.Add "Cecum", "Cecum"
.Add "Tail", "Tail"
.CompareMode = TextCompare '****This Line Causes the "Invalid Procedure or Call" Error"****
End With
'...code...
End Sub