Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split function to an array. Type mismatch error #13

I have a string with multiple email addresses separated by semicolons and want to split them into separate values.

Dim RecipientArray() As Variant 'I've also tried as string
Debug.Print txtRecipients.Value
RecipientArray = Split(txtRecipients.Value, ";") 'error happens here
For i = 0 To UBound(RecipientArray)
    Debug.Print RecipientArray(i)
Next
like image 413
Cloude Avatar asked Feb 11 '16 18:02

Cloude


1 Answers

Make RecipientArray a plain Variant instead of a Variant array.

'Dim RecipientArray() As Variant 'I've also tried as string
Dim RecipientArray As Variant
like image 170
HansUp Avatar answered Oct 19 '22 14:10

HansUp