-
How to pass a part of a Nested Array to a function?
fieldnames = Array(Array("Account Class", "LE", "Acc-Pro", "BU", "DS", "CCY", "Value"), Array("Account Class", "Legal Entity", "Account", "Business Unit", "Data Source", "CCY", "Balance (USD)"), , Array("Account Type", "Legal Entity", "Account", "Product", "Business Unit", "Data Source", "Transaction Currency", "USD Equiv - Prior Period"), Array(, , "+-", "=Right((), 6)", , "=Left((),3)"))
i=0
Call Locate_Matrix(files(i), fieldnames(i+1))
Function Locate_Matrix(ByVal bookname As String, fieldlist() As Variant) As Boolean
Why I am getting an Type mismatch saying "Array or User-defined type expected" Highlighting the fieldnames(i+1). At the same time Isarray(fieldnames(i+1)) returns true. How come?
-
I think the signature of the function is wrong, change:
Function Locate_Matrix(ByVal bookname As String, fieldlist() As Variant) As Boolean
to:
Function Locate_Matrix(ByVal bookname As String, fieldlist As Variant) As Boolean
-
that means there is no need to explicitly declare variable as an array in functional parameters?
-
No, it means that you can assign an array to a variable of type Variant, without declaring it as an array of variants.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules