我有一个字符串,其中多个电子邮件地址以分号分隔,并希望将它们拆分为单独的值。
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
答案 0 :(得分:4)
使RecipientArray
成为普通的Variant而不是Variant数组。
'Dim RecipientArray() As Variant 'I've also tried as string
Dim RecipientArray As Variant