在函数中传递数组 [英] Passing array in function

查看:23
本文介绍了在函数中传递数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样读取的数组:

I have an array that is read like this:

MyArray(0)='test'
MyArray(1)='test2'
MyArray(2)='test3'

如何通过函数传递它?

Function(MyArray(all_arrays)) 

我为 all_arrays 放了什么?

推荐答案

MyArray(0)='test'
MyArray(1)='test2
MyArray(2)='test3'

AcceptArray MyArray

Private Function AcceptArray(myArray())
'Code here
End Function

您似乎想在数组之前传递一个字符串.

You look to want to pass a string before the array.

因此,将函数更改为:

Private Function AcceptArray(param1, myArray)
'Code here
'Don't forget to return value of string type.
End Function

你这样调用这个函数:

returnValue = AcceptArray("MyString", MyArray)

如果不需要返回值,则应使用 Sub.

If you do not need to return a value you should use a Sub.

这篇关于在函数中传递数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆