excel - Evaluate("1") gives error 438 -
i have few "why?"s evaluate...
sub testevaluate() dim tag string tag = "5" tag = evaluate(tag) 'works fine tag = "1" tag = evaluate(tag) 'error 438 wrong property or method(-> 1st "why?")
but ok can handle it:
tag = "1" tag = [tag] 'works fine
now need evaluate property of object:
dim object cobject set object = new cobject object.pproperty = "5" tag = evaluate(object.pproperty) 'works fine
and 1 time again same problem above:
object.pproperty = "1" tag = evaluate(object.pproperty) '438 wrong property or method
but i'm traped, becouse:
tag = [object.pproperty] 'generates error 13 type mismatch(-> 2nds "why?")
is there solution without need utilize new variable?
dim temptag string temptag = object.pproperty tag = [temptag] 'everything fine 1 time again end sub
i found out, in case vba.evaluate("1") generates object according to
debug.print vba.vartype(evauate("1"))
it`s bug? (win8.1 xl2007)
i set look brackets , problem disappeared; works fine now:
tag = evaluate("(" & tag & ")")
excel vba excel-vba
No comments:
Post a Comment