I have several type structures that have many element names in common. Currently to deal with that I have a bunch of select cases to determine which type to use and then get the proper element. To avoid all the case statements it occurred to me I could use the replace function - but I can't get this to work. Here is a way dumbed down section of code to illustrate my requirement:
What I would like to do is replace the "X" in "T.X" to get the T.lTest element. The above code gets a vartype error as my evaluate is returning a string. I tried to replace the quotes with another replace using chr(34) but that didn't work either.Type TEST lTest As Long iTest As Integer sTest As String 'many more elements End Type Sub UseVaribleforType() Dim T As TEST Dim lRet As Long T.lTest = 1 'this is where i would like to evaluate T.lTest with a variable lRet = Evaluate(Replace("T.X", "X", "lTest")) End Sub
SNB, I think this ones for you?
Thanks,
Bookmarks