Solution:
1. From the object browser to check the reference Dictionary belongs to which class libraries, Excel should use Scripting library
2. Search the Dictionary object have the same name
3. If you are sure no problem, then the program starts with the APPLICATION. The SCREENUPDATING=FALSE ON ERROR RESUME NEXT, solved the end program to reset the screen update,
Experiences and lessons of the blood, the hope can help you,
CodePudding user response:
Ha ha, what do you think of the so-called "lesson" can you help others?Pull down......
For "1" : general use Dictionary object, are made of Scripting library system to provide the Dictionary class,
If you have special requirements, to their implementation, or reference implementation in other libraries,
For "2" : in general, or different function in the different scope of specific variables, variable names are different,
In the code "the Dictionary object have the same name," don't know yourself? I don't know if you need to find...
For the "3" :
APPLICATION. SCREENUPDATING=FALSE basically used only for the VBA in Excel,
If the operation work table itself is not in the "front", or it is "invisible" (I use VB6 code, for example, by
COM interface operation Excel worksheets), the code, I'm afraid there is no active substance,
And most of all On the Error Resume Next isn't "is used to solve the runtime Error 457"!
You use this time, seemed to "problem solving", maybe it's just "coincidence", just to meet your expectations!
But others may need different, need to "practical processing" this keyword repeated problems,
Can use a simple "On the Error Resume Next" to "ignore a runtime exception" line???????
Actual demand is different, treatment is not "same", you said this method does not have versatility,
And, I don't think your application scenario "On the Error Resume Next" the only way, but there are "better" way!
CodePudding user response:
The key is the only dictionary, what is strange,CodePudding user response:
Should change like this:dim dict as new dictionary
'...
Then if dict. The exists (key)
Msgbox key & amp; "Already exists!"
Dict. Item (key)=value 'optional
The else
Dict. Add (key, value)
End the if
'...
CodePudding user response:
Wrong, should change like this:dim dict as new dictionary
'...
Then if dict. The exists (key)
Msgbox key & amp; "Already exists!"
Dict. Item (key)=value 'optional
The else
Call dict. Add (key, value) 'increase a call, or remove the parentheses can.
End the if
'...
CodePudding user response:
The