Solved

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

Posted on 2013-01-23
1
442 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 51

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now