ubound(myArray) - gives error
isEmpty doesn't work
Please Help me! I'm stuck
Printable View
ubound(myArray) - gives error
isEmpty doesn't work
Please Help me! I'm stuck
You need the help of an API:
If the return value is greater than 0 then the array is dimensioned, otherwise it's not.VB Code:
Option Explicit Private Declare Function SafeArrayGetDim Lib "oleaut32" (ByRef saArray() As Any) As Long Private Sub Form_Load() Dim testarray() As String Debug.Print SafeArrayGetDim(testarray) End Sub
Thank you sooooo much!!!!
You can also do it without an API like this.
Code:Public Function IsDimmed(byRef vArray As Variant) As Boolean
On Error goto Erro:
'This causes an Handled error if the array isn't dimmed
'and returns False
IsDimmed = IsNumeric(UBound(vArray))
Erro:
End Function