2

I am writing a VBA class and trying to create a property which allows to set the value of an array item through assignment (= operator).

Something similar to this: https://msdn.microsoft.com/en-us/library/aa259714(v=vs.60).aspx

So the signature will be like : object.PropertyName(index) = string

Is it possible in VBA? If yes, then can you please explain how.

Thanks!!

dePatinkin
  • 2,239
  • 1
  • 16
  • 15
cyboashu
  • 10,196
  • 2
  • 27
  • 46

1 Answers1

2

You can find the answer here 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
Community
  • 1
  • 1
dePatinkin
  • 2,239
  • 1
  • 16
  • 15