How do I handle a dynamic array before redim without causing any errors. I have a function that test if it causes Subscript out of range (Error 9) and returns true if it does, but is there any other way?
Printable View
How do I handle a dynamic array before redim without causing any errors. I have a function that test if it causes Subscript out of range (Error 9) and returns true if it does, but is there any other way?
You can do somwthing like this:
Code:Private Sub Command1_Click()
Dim arr() As String
Dim intNumber As Integer
On Error Resume Next
intNumber = UBound(arr)
If Err.Number = 9 Then
MsgBox "Array is not dimensioned."
End If
End Sub
I just put an error handler in or do what you've done and make a function to test it, I can't see why you need another way round it
No, I knew it! There was no other way to do it. I thought there should be something like Ismissing or Isnull but, no, no way. Thanks four your support Serge, but you have to read more carefully, I have a function for that allready.