我有一個函數,它檢查數組是否爲空。由於今天我得到一個運行時錯誤9.我不知道爲什麼。如何檢查VBA中的數組是否爲空?
下面是代碼:
When db table contains data, pass it to the variable => arrItems
arrItems as Variant
ArrEmpty as Boolean
With rs
If Not .EOF Then
arrItems = .GetRows
.Close
End If
End With
ArrEmpty = IsArrayEmpty(arrItems)
Private Function IsArrayEmpty(parArray As Variant) As Boolean
IsArrayEmpty = IIf(UBound(parArray) > 0, False, True) //Here is invoked the runtime error 9
End Function
如何檢查,如果數組是空的?
http://stackoverflow.com/questions/206324/how-to-check-for-empty-array-in-vba-macro –
可能d重複的[如何檢查空數組在vba宏](http://stackoverflow.com/questions/206324/how-to-check-for-empty-array-in-vba-macro) – LWC