问题
I'm getting an error Run-time error '424': Object required when I try to create a dictionary in VBA. My code is shown below:
Private Sub data()
Dim dicti As Object
Set dicti = CreateObject(Scripting.Dictionary)
How can I fix this issue?
回答1:
Try,
dim dicti As Object
Set dicti = CreateObject("Scripting.Dictionary")
Alternately, swap the late binding for early binding by accessing the VBE's Tools, References and including Microsoft Scripting Runtime with a check.
dim dicti as new Scripting.Dictionary
来源:https://stackoverflow.com/questions/51233284/declaring-a-dictionary-in-vba