Reputation: 5064
I have list of variables in an include files which is looks like:
var_1 = "string"
var_2 = "string"
on the main file i need variable created on the fly so i do
' somewhere i have the num variable
Execute("new_var = var_"&int(num))
Exactly on the execute line i got this error
Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript
Any idea guys?
thanks
Upvotes: 0
Views: 2552
Reputation: 5064
I made it, the error come up when i use casting type to the num variable
Execute("new_var = var_"&int(num))
but
Execute("new_var = var_"&num)
works, thanks
Upvotes: 0
Reputation: 189505
Use arrays to acheive this sort of thing:-
ReDim var(1)
var(0) = "String"
var(1) = "String"
''# somewhere I have the num variable
new_var = var(num)
Upvotes: 2