0

Object doesn't support this property or method下面的代码给了我一个HelperFunctions.updatecontractlist (PC)

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim PCName As String, BU, PC As Variant
    If Target.Address = "$B$1" Then
        PCName = Target.value
        For Each BU In TotalBook.GetBUs
            For Each PC In BU.GetPCs
                If PC.Name = PCName Then HelperFunctions.updatecontractlist (PC)
        Next PC, BU
    End If
End Sub

哪里updatecontractlist是:

Public Sub updatecontractlist(PC As Variant)

 whatever

End Sub

并且PC是自定义对象,在代码的许多其他部分都可以正常工作,我可以在我的Watches窗口中看到,当错误发生时它已正确加载。

我错过了什么?

4

1 回答 1

0

你应该改变:

If PC.Name = PCName Then HelperFunctions.updatecontractlist (PC)

If PC.Name = PCName Then Call HelperFunctions.updatecontractlist (PC)

或者

If PC.Name = PCName Then HelperFunctions.updatecontractlist PC

于 2014-02-14T13:30:07.000 回答