Article ID: 174004
Article Last Modified on 7/16/2004
Private myarray() as String
Public Property Get marray(ByVal subscript As Integer) As String
marray = myarray(subscript)
End Property
Public Property Let marray(ByVal subscript As Integer, _
ByVal vNewValue As String)
On Error GoTo err_Array_Not_Initialized
If subscript > UBound(myarray) Then
ReDim Preserve myarray(subscript)
End If
myarray(subscript) = vNewValue
Exit Property
err_Array_Not_Initialized:
If Err.Number = 9 Then
ReDim myarray(1)
Resume
End If
End Property
Public aVariant As Variant
Private Sub Class_Initialize()
Dim anArray(2)
anArray(1) = "Hello"
anArray(2) = "World"
aVariant = anArray
End Sub
Private Sub Form_Click()
Dim obj As New Class1
With obj
.aVariant(1) = "Goodbye"
.aVariant(2) = "Everyone"
Debug.Print .aVariant(1)
Debug.Print .aVariant(2)
End With
Set obj = Nothing
End Sub
Keywords: kbbug kbfix KB174004