Solved

how to pass in a list of string/numbers into a vbs function

Posted on 2013-01-23
1
444 Views
Last Modified: 2013-01-23
I have the following vbs function that accepts a parameter array

Function TEST(Arr())
   k=ubound(Arr)
   msgbox(k)
End Function

The calling function in this system is dynamically generated as a string and then a msscript control invokes it.

How can I call the function and pass in the array by init its values as a string using the following syntax?

Dim numbers = New Integer() {1, 2, 4, 8}
Dim doubles = {1.5, 2, 9.9, 18}

Example:

TEST({1,2,3,4}) '<--how can i pass these in as literals?
0
Comment
Question by:glenn_r
1 Comment
 
LVL 53

Accepted Solution

by:
Bill Prew earned 265 total points
ID: 38811330
Here is the correct VBS syntax:

TEST(Array(1,2,3,4))

Function TEST(Arr())
   k=ubound(Arr)
   msgbox(k)
End Function

Open in new window

~bp
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question