
Originally Posted by
pbaldy
I guess if you don't need any other emails from the string that function will do it.
I've written this function to loop through any number of characters you want to slice and puts it into an array. I'd need another set of eyes to glaze over it...
Code:
'cuts up the string into an array depending on the number of characters you want
Function sliceCharByNum(FullString As String, NumberOfCharacters As Long) As String()
If Len(FullString) = 0 Then
Dim arrEmpty() As String
ReDim arrEmpty(0 To 0) As String
arrEmpty(0) = FullString
sliceCharByNum = arrEmpty()
Else
Dim SliceByNum As Long, CurrentVal As Long, i As Long
Dim strText As String, strImportedText As String, strTextFinished As String
Dim arr() As String
ReDim arr(0 To 0) As String
NumFrom = Len(FullString)
SliceByNum = IIf(NumberOfCharacters = 0, 1, NumberOfCharacters)
strImportedText = FullString
CurrentVal = Len(strImportedText)
i = 0
Do Until strImportedText = ""
If Len(strImportedText) < NumberOfCharacters Then
Debug.Print "current i = " & i
ReDim arr(0 To i) As String
arr(i) = strImportedText
Debug.Print "HERE" & arr(i)
strImportedText = ""
Else
strText = ""
strText = Left(strImportedText, NumberOfCharacters)
CurrentVal = CurrentVal - NumberOfCharacters
Debug.Print CurrentVal
strImportedText = Right(strImportedText, CurrentVal)
ReDim arr(0 To i) As String
arr(i) = strText
i = i + 1
End If
Loop
End If
End Function