What is the correct way to pass an Array into a function
- From: c.santee@xxxxxxxxx
- Date: 25 Dec 2006 16:04:21 -0800
All,
Could somebody please help me figure out how to pass an array into a
function. I've been trying different variations of this code, but
continue to have a problem when I attempt to pass myArray() into
fnDisplayMSG... I know that fnTmp is correct, except for the fact that
I can't figure out how to declare myArray(), because when I call the
MessageBox from within the function, the function works, however when I
use the Call fnDisplayMSG(x, myArray()) I receive an error.
Any help on declaring an array or correctly passing an array into a
function would be greatly appreciated. Thanks in advance. - CES
Public Function fnDisplayMSG(x As Integer, myArray() As String) As
String
MsgBox (myArray(x))
End Function
Public Function fnTmp(x As Integer) As String
'Dim myArray() As String
myArray = Array("Value 1", "Value 2", "Value 3", "Value 4", "Value 5")
Call fnDisplayMSG(x, myArray())
'MsgBox (myArray(x))
End Function
.
- Follow-Ups:
- Re: What is the correct way to pass an Array into a function
- From: McKirahan
- Re: What is the correct way to pass an Array into a function
- Prev by Date: Re: Update item value in a dictionary object?
- Next by Date: Re: What is the correct way to pass an Array into a function
- Previous by thread: Re: User Listing using VBScript/"0
- Next by thread: Re: What is the correct way to pass an Array into a function
- Index(es):
Relevant Pages
|