我正在编写一个VBA类并尝试创建一个属性,该属性允许通过赋值(=
运算符)设置数组项的值。
类似于此的内容:https://msdn.microsoft.com/en-us/library/aa259714(v=vs.60).aspx
所以签名就像:object.PropertyName(index) = string
VBA有可能吗?如果是,那么请你解释一下。
谢谢!
答案 0 :(得分:2)
您可以在VBA - Returning array from Property Get
找到答案Private v() As Double Public Property Get Vec(index As Long) As Double Vec = v(index) End Property Public Property Let Vec(index As Long, MyValue As Double) v(index) = MyValue End Property