Calling function or sub with variable array or string names 
Author Message
 Calling function or sub with variable array or string names

Hello
I'm having problems of passing a  string( ) or array with different
names to a function

I have a Function that uses a  Name( ) as String component. I want to
call this function but change the string name as desired.

eg

Dim  Test1( ) as String
Dim   Test2 ( ) as String

Function DoThis(Name( ) as String)

.....
y= Name(i)

End Sub

When I call the function with DoThis(Test1) or DoThis(Test1( ) ) I get a
mismatch error

Appreciate if somebody what silly mistake I'm making

Thanks



Mon, 24 May 2004 01:29:35 GMT  
 Calling function or sub with variable array or string names
Dawid

could be that your Function is getting confused.  I think the word "Name"
may be reserved by Excel/VBA.  For example,

Name OldName As NewName    ' Rename file.

Try changing the name of your variables/parameters to something else.

Regards

Trevor


Quote:
> Hello
> I'm having problems of passing a  string( ) or array with different
> names to a function

> I have a Function that uses a  Name( ) as String component. I want to
> call this function but change the string name as desired.

> eg

> Dim  Test1( ) as String
> Dim   Test2 ( ) as String

> Function DoThis(Name( ) as String)

> .....
> y= Name(i)

> End Sub

> When I call the function with DoThis(Test1) or DoThis(Test1( ) ) I get a
> mismatch error

> Appreciate if somebody what silly mistake I'm making

> Thanks



Mon, 24 May 2004 06:47:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling a sub procedure whose name is in a variable: call me.ProcToRun

2. how do i call a function by using the function name as a string of characters

3. call sub or function with arguments of arrays

4. Calling functions/subs using the string title - possible?

5. calling sub by variable name

6. Calling a Function using an array or variable

7. Call a Function from string variable

8. Call a Function from string variable

9. Call a Function from string variable

10. Call Let/Get Prop using string variable for name


 
Powered by phpBB® Forum Software © phpBB Group