I have an array of 5 variant objects (text from userform textboxes) that I need to convert to string objects so that I can subsequently use the Left function with them. I found a thread posted by Mark O'Brien in 2002 about this (Convert Variant Array to String Array) but cannot get it to work.
Can anyone help convert my array to string objects please?
Any help much appreciated.
Can anyone help convert my array to string objects please?
VBA Code:
Sub ArraytoString()
Dim Targets(1 To 5) As Variant
Dim MyTArray(1 To 5) As String
Dim i As Integer
Set Targets(1) = frmRapid1.txtNum1
Set Targets(2) = frmRapid1.txtNum2
Set Targets(3) = frmRapid1.txtNum3
Set Targets(4) = frmRapid1.txtNum4
Set Targets(5) = frmRapid1.txtNum5
ReDim MyTArray(UBound(Targets)) As String 'throws error array already dimensioned
For i = 1 To UBound(Targets)
MyTArray(i) = CStr(Targets(i))
Next
End Sub
Any help much appreciated.