How to pass a Function returning an array as a parameter

  • Thread starter Guillermo López-Anglada
  • Start date
G

Guillermo López-Anglada

Hello,

If a have a function which returns a multidimensional array. How can I
pass it as parameter for a subprocedure?

Here's a skeleton of my code:

Function CreateAnArray()

'code to fill a resizable array called MyArray() as String

CreateAnArray = MyArray()

End Function

Sub UseOneArray(OneArray() as String)

'do things with OneArray()

End Sub

Call UseOneArray (CreateAnArray)

This code doesn't work. I'd appreaciate any help in order to do that.

Regards,

Guillermo
 
J

Jezebel

Currently your CreateAnArray function returns a variant, so you get a
mismatch if you try to pass its output to a function that wants a string
array. Declare it explicitly --

Function CreateAnArray() as string()
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top