Vba 创建通过赋值接受值的类索引属性

Vba 创建通过赋值接受值的类索引属性,vba,Vba,我正在编写一个VBA类,并试图创建一个属性,该属性允许通过赋值(=运算符)设置数组项的值 类似于此: 因此签名将类似于:object.PropertyName(index)=string 在VBA中可能吗?如果是的话,请你解释一下怎么做 谢谢 你可以在这里找到答案 Private v() As Double Public Property Get Vec(index As Long) As Double Vec = v(index) End Property Public Propert

我正在编写一个VBA类,并试图创建一个属性,该属性允许通过赋值(
=
运算符)设置数组项的值

类似于此:

因此签名将类似于:
object.PropertyName(index)=string

在VBA中可能吗?如果是的话,请你解释一下怎么做


谢谢

你可以在这里找到答案

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