我正在编写应该从 Excel 工作表中读取数据的代码,将其作为字符串保存到包含在我定义的类的对象中的变量中,然后将此对象添加到我还定义的类的对象树中.
Dim ProdTreeMain As New CProdTree
Dim nR As Range
Dim nnR As Range
Set nR = oXS.Range("A1")
Set nnR = oXS.Range("A1")
dim r as integer
r = 1
Do While Not (nR.Text = "" And nnR.Text = "")
If CONDITION IS TRUE:
Dim currProd As 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
CProdTree 类包含一个子“addProduct”,它通过引用获取类 CProduct 的输入对象。
Public Sub addProduct(ByRef Prod As CProduct)
这到底是怎么回事?该类已定义,子正确,传递给子的变量类型是正确的类,但我收到此错误...:/