Quick and easy! -- Create an array from a string or a string from an array.
Quick and easy! -- Create an array from a string or a string from an array.
Rate Quick and easy! -- Create an array from a string or a string from an array.
(1(1 Vote))
Dim aryTest() As String
Dim strText As String
Dim lngCount As Long
strText = "This is a test"
'Create the array
aryTest = Split(strText)
'You now have a one-dimensional zero-based array with the substrings as the elements
'Print out the array in the Immediate Window
For lngCount = 0 To UBound(aryTest)
Debug.Print aryTest(lngCount)
Next
End Sub
Private Sub Array2String()
Dim aryTest(4) As String
Dim strText As String
aryTest(0) = "This"
aryTest(1) = "is"
aryTest(2) = "a"
aryTest(3) = "test"
'Create the string
strText = Join(aryTest)
'You now have a space-delimited string made up of the elements in your array
'View in the Immediate Window
Debug.Print strText
End Sub
Quick and easy! -- Create an array from a string or a string from an array. Comments
No comments yet — be the first to post one!
Post a Comment