Excel 2010 vba array as a class member error -


i working on project , have run don't understand. when assigning array class member, let , get names cannot same. if are, error:

definitions of property procedures same property inconsistent, or property procedure has optional parameter, paramarray, or invalid set final parameter

can tell me if i'm doing wrong, or if how is. code below generates above message.

test code:

sub loadserver() dim testserver avayaserver dim long dim arr() variant  arr = array("1", "2", "3", "4", "5")  set testserver = new avayaserver testserver.name = "this sucks" testserver.skill = arr msgbox testserver.skills(4) msgbox testserver.name  end sub 

class code:

private pname string private pskills() string public property skills() variant skills = pskills() end property  public property let skills(values() variant) redim pskills(ubound(values)) dim long = lbound(values) ubound(values)     pskills(i) = values(i) next end property 

change values() variant values variant:

class code:

private pname string private pskills() string public property skills() variant skills = pskills() end property  public property let skills(values variant)          'fixed here redim pskills(ubound(values)) dim long = lbound(values) ubound(values)     pskills(i) = values(i) next end property 

explanation:

values variant of type variant, later use store array. values() variant array of type variant, array cannot assigned; array can assigned former.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -