Function calls

1. Gino Guest

## Function calls

Is there a way to call a function using only one variable which includes all of it&#039s arguments?<BR>eg.<BR><BR>Function A(var1, var2)<BR>End Function<BR><BR>Sub test()<BR> testvar="45,67"<BR> call A(testvar)<BR>End Sub<BR><BR>I looked at eval and exec but they don&#039t work.<BR>Any ideas?

2. MG Guest

## RE: Function calls

Yes, you could pass an array and parse the array in the function.<BR>What is so bad about<BR>call A(45,67)<BR>??

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## RE: Function calls

How about using an array?<BR><BR>Function A(argArray)<BR>...<BR>End Function<BR><BR>testvar = Array(45,67)<BR>x = A(testvar)<BR><BR>But I think you are wrong. Eval should be able to do this:<BR><BR>x = eval( "A(" & testvar & ")" )<BR><BR>??? yes ???<BR><BR>Of course, I *must* ask WHY???<BR><BR>

4. Gino Guest

## RE: Function calls

There is nothing bad with A(45,67) but the place I collect the<BR>information is far away (pagewise) from where I actually call the function. So it would be much easier to store the function call variables in one variable and then just call the function at the end.<BR>So, anybody?

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## RE: Function calls

So store them in an array. One variable. Presto.<BR><BR>But I can&#039t see why it hurts to store them in two or three or whatever. Storing them in a string is--pardon me but it is my opinion--silly. You have the overhead of converting them to a string and then converting back to numbers to use them. What a waste for, *I* think, zero gain.<BR><BR><BR><BR>

6. Gino Guest

## RE: Function calls

Well, the reason why I cannot use an array for A is because A is a class function that cannot be changed.<BR>I tested the x = eval( "A(" & testvar & ")" ).<BR>Works! <BR>You are my favorite person!<BR>Thanks.

7. Gino Guest

## RE: Function calls

It really depends on the implementation.<BR>But it works! Thanks again!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•