Set property of vba class with object reference -
i have class module, named normal
, in vba following code:
private mline lineelement public property line() lineelement line = mline end property public property set line(byref vline lineelement) mline = vline end property
this class used following code:
sub run dim line lineelement set line = new lineelement dim norm normal set norm = new normal set norm.line = line 'fails here "object variable or block variable not set"' end sub
also, if change code in normal
class module to:
private mline lineelement public property line() lineelement line = mline end property public sub setline(byref vline lineelement) 'changed property sub' mline = vline end property
and failing line
norm.setline( line )
i "object not support property or method" error. doing wrong in both of these cases?
try this:
private mline lineelement public property line() lineelement set line = mline end property public property set line(byref vline lineelement) set mline = vline 'note added set keyword in line' end property
Comments
Post a Comment