Many posts on Tek-tips are solved by one helpful member pointing out that the reason a chunk of coded doesn't work is that a RESERVED WORD has been used to define a variable name.
This problem can be avoided and thus save loads of debugging time by adopting simple naming conventions for variables defined at runtime.
By using a 3 letter prefix to all variables created, you can be relatively certain that the reason your code won't run, is not because you've used a reserved word.
I use the following conventions;
Code:
DataType Prefix Result
Byte byt bytVarName
Integer int intVarName
Long lng lngVarName
Single sng sngVarName
Double dbl dblVarName
String str strVarName
Boolean bol bolVarName
Not only does this prevent the use of a reserved word, but when you are debugging, you can tell at a glance what data type your variable is, without having to trawl through line after line until you find the Dim statement.
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.