Function IsReDim(ByRef MyArray() As Variant) As Boolean
On Error GoTo Z
Dim szTmp
szTmp = Join(MyArray, ",")
IsReDim = LenB(szTmp) > 0
Exit Function
Z:
IsReDim = False
End Function
IsReDim判断数组是不是被分配过,如果是动态数组被Erase了,将返回False
使用例子:
If IsReDim(uArray) Then
'uArray里面有数据
Else
'uArray里面没有数据
End If
' 作者:唐细刚