Results 1 to 2 of 2

Thread: passing arrays as arguments

  1. #1
    Guest
    Say I have an array dimensioned, and I need to use it in a subprocedure, how do I define the subprocedure, and what is the syntax to pass the array?

    I.E.

    Dim array(12) as string

    private Sub DoStuff(array here)
    End Sub

    and then calling the function DoStuff would be done how?



    Thanks in advance

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    This seems to work


    Code:
    Private Sub Form_Load()
    Dim Arr() As String
    ReDim Arr(0)
    Arr(0) = "JOP"
    MySub Arr
    End Sub
    
    Sub MySub(Arr() As String)
    MsgBox Arr(0)
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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