-1
我已經使用Get和Let設置了測試類,但是當指定的值不返回時。讀取VBA中的自定義類屬性不起作用
'Set up test class
Private lTargetName As String
Public Property Get TargetName() As String
TargetName = ITargetName
End Property
Public Property Let TargetName(value As String)
lTargetName = value
End Property
Sub test()
Dim sharedColumn As TestClass
Set sharedColumn = TestClass
sharedColumn.TargetName = "test"
Debug.Print sharedColumn.TargetName ' returns blank
End Sub
你在哪裏創建實例?我的代碼中沒有看到「New」。 – cyboashu