vba error 438 but object class does contain sub -


i writing code supposed read in data excel worksheet, save strings variables contained in object of class have defined , add object object tree of class have defined.

dim prodtreemain new cprodtree dim nr range dim nnr range set nr = oxs.range("a1") set nnr = oxs.range("a1") dim r integer r = 1  while not (nr.text = "" , nnr.text = "")     if condition true:          dim currprod new cproduct          prodtreemain.addproduct (currprod) '<-- error 438 "object doesn't support property or method      end if     r = r + 1     set nr = oxs.range("a" & cstr(r + 1))     set nr = oxs.range("a" & cstr(r + 2))  loop 

the class cprodtree contains sub "addproduct" takes input object of class cproduct reference.

public sub addproduct(byref prod cproduct)

what hell going on? class defined, sub correct, variable type being passed sub of correct class , yet error ... :/

you need drop parentheses around argument. favorite explanation daily dose of excel post.

this line:

prodtreemain.addproduct (currprod) 

becomes:

prodtreemain.addproduct currprod 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -