Results 1 to 5 of 5

Syntax for Passing Arrays to Functions

Threaded View

ffffloyd Syntax for Passing Arrays to... 04-21-2009, 02:14 AM
DonkeyOte Re: Syntax for Passing Arrays... 04-21-2009, 02:34 AM
Richard Schollar Re: Syntax for Passing Arrays... 04-21-2009, 03:47 AM
foxguy Re: Syntax for Passing Arrays... 04-21-2009, 12:54 PM
ffffloyd Re: Syntax for Passing Arrays... 04-21-2009, 08:34 PM
  1. #1
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Syntax for Passing Arrays to Functions

    What is the syntax for passing arrays to functions?

    In other words, for the following simple test example, what would work? It is highlighting the asValue parameter and saying, "Type mismatch: array or user-defined type expected". This occurs whether or not I follow it with the empty parentheses.
    Function ArrayCall(ByRef A() As Variant) As Boolean
    
        ArrayCall = True
        
    End Function
    
    Sub TestArrayCall()
    Dim asValue(2) As String
    
        Call ArrayCall(asValue())
        
    End Sub
    I want the function to be able to accept an array of any type, hence the "As Variant" type in the definition despite the call being made with an array of strings.
    Last edited by ffffloyd; 04-21-2009 at 08:34 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1