Results 1 to 4 of 4

Thread: dynamic array before redim

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    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

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width