
dynamically dim a variable ie dim "variable"&n
bar1 = "blah"
n = 1
foo eval("bar" & n)
sub foo(arg)
msgbox arg
end sub
Note that using arrays is probably a better solution to whatever the *real* problem is (which you never really stated ;-)...
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--
Quote:
> I'm trying to dim a variable that I am creating so I can pass it
> between functions only I can't seem to do it. Is this even the best
> way of doing it???
> I've tried numerouse eval type commands but haven't managed to work
> it out.
> any help would be much appreciated, I basically want to dim a variable
> called "visitpages"&n where n is an integer.
> Thanks again,
> Mike.