I'm sure there's a way to do it and I even think I've done it in the past but I can't find it and an internet search gave me AddressOf and CallByName.
I use callbyname to recolor my forms at run-time per user preferences.
So this is what I'm trying to do.
I'm writing a thing that chooses a random thing to do. Let's say there's 20 choices of random things.
So I have this:
Sub Random00
End Sub
Sub Random01
End Sub
and so on.
To call it I do this:
What I'd like to do is this:Code:Sub DoARandomThing Dim nRnd as long nRnd=int(rnd * 19) Select Case nRnd Case 0 Random00 Case 1 Random01 etc.
Code:Sub DoARandomThing Dim nRnd as long nRnd = int(rnd * 19) CallSubroutineByName "Random" & format(nrnd, "00")




Reply With Quote