excel vba - How to update the field of Ojbect in VBA? -
when use vba, want update object's field function, don't know how that.
an 1 give me advice?
type myobject string b boolean end type 'update function sub update(byval o myobject, key string, value string) o.key = value 'this want do! end sub
i don't know vba, possible?
you cannot set value of field named key
, because such key not exist in definiton of myobject
. can this:
o.a = key o.b = value
edit
to specify field want update, can add conditional statement function.
if key = "a" o.a = value else o.b = value end if
i'm afraid cannot loop through fields in type, because vba not support reflection.
Comments
Post a Comment