Naming conventions for variables

G

Guest

After about 20+ years working in xBase and VFP, I have been accustomed to a
naming convention which guarantees avoiding Key Words as names. I find very
little evidence of the existence of any STANDARD naming convention in VBA --
which I think is a pity.

The convention with which I am most familiar is a three part construct:

SCOPE + TYPE + NAME.

In VFP the scope choices are:

g -- Public ("Global")
p -- Private
l -- Local

The types are like:

chr -- Character
int -- Integer

The name can be pretty well anything within reason. So a Character variable
with Private scope might have a name like:

pchrDoofus

... and an Integer variable with Public scope could be

gintBigNum

The only example I have seen anywhere so far in Excel has been one helpful
individual who used "rng" as the prefix for a Range name:

For Each rngCell In Range("K2", "K13")

So, my question is this: Is there a standardized Naming Convention for VBA?
Microsoft KnowledgeBase doesn't seem to think so, but I know that the VFP
community had the current one for years before MS adopted it. Perhaps all
y'all (I live in the Sahth (that, for the benefit of my Yankee friends, is
how we pronounce "South" down here) may have either a standard one to which
to refer me, or just a preferred private one you could share with me.
 
G

Guest

Splendid -- just what I was looking for. JE McGimpsey's answer is more
concise, and probably the one I will print out. I had found KB110264
previously, but it seemed almost too comprehensive.

I shall feel a whole lot more comfortable using these <g>! Thanks.
--
Dave
Temping with Staffmark
in Rock Hill, SC


Jim Thomlinson said:
 
G

Guest

Jim Thomlinson pointed me to that big ol' KB110264, but I think the one I
print out is the one you linked me to. Seems a bit more concise and to the
point of VBA specifics.

Large thanks -- a great help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top