So, who knows a good way to create around 70 string variables without having to type code until your eyes bleed?
I'd love to know if there's a simple way. (loops maybe???)
Use an array and populate it with a loop. Think of it as an indexed Variable.
'------------------------------------------------
Dim strVar()
Sub Test()
Dim i As Integer
'Create them
For i = 0 To 70
ReDim Preserve strVar(i)
strVar(i) = "THIS is String Number " & i
Next i
'View them
For i = 0 To UBound(strVar)
MsgBox strVar(i)
Next i
End Sub
'--------------------------------------------------------
But then it more-or-less defeats the point of having named variables you know- the convenience of having meaningful names of the thinnggys - which get a bit blurry when EVERYTHING is just [strVar(nn)].
Then too, the concept of just lumping everthing into a featureless morass of variants does not exactly provide the niciety of type checknig, so perhaps you could omit the option explicit statement and not use ANY declaration statements. This would save typing the 35 or so 'words' which create the featureless blob to begin with - increasing 'efficiency', decreasing the 'bloody finger' syndrome all while adding a great deal of mystery to the puzzle program.
Another consideration may be the 'bloody finger' syndrome, when you actually use the variables, as the use will (now) include the entry of the index (3 or 4 keystrokes) EVERY time you use it. So, it COULD be that the 'technique' is just an implementation of the 'pay-me-now or pay-me-later' syndrome.
In summary, my opinion is that the technique is really another example of a bad idea gone sadly awry. I -personally- have never suffered from the 'bloody finger' syndrome, but then (perhaps) the calluses from a year or more of actual programming has built up enough protection on my fingers to keep me safe through more than 70 declaration statements.
MichaelRed
m.red@att.net
There is never time to do it right but there is always time to do it over
Another positive post from MichaelRed to lighten up the atmosphere in this forum Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.