The Get Keys() attribute is slow with a decent sized data set. Is there a way to assign keys without looping through each record individually?
I can only find examples of for or do loops to assign keys individually.
Public Property Get Keys() As String()
'Here is the existing code (status bar updated only so the user knows the
'program is still working).
Dim vlist() As String, i As Long, myKey As Variant, myArr() As Variant, okVP As KeyValuePair, StatBar As String
StatBar = Application.StatusBar
If Me.Count > 0 Then
ReDim vlist(0 To Me.Count - 1)
For i = LBound(vlist) To UBound(vlist)
Set okVP = KeyValuePairs(i + 1)
vlist(i) = okVP.Key
If i Mod 5000 = 0 Then
Application.StatusBar = StatBar & ": "& "Gathering Keys: "& Format(i, "#,##0") & " of "& Format(UBound(vlist), "#,##0")
' Debug.Print i & " of "& UBound(vlist)
DoEvents
End If
Next i
Keys = vlist
End If
Application.StatusBar = StatBar
End Property
Current approach takes >5 min for ~135K records.