-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