Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Naming conventions for variables

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 a

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.
--
Dave
Temping with Staffmark
in Rock Hill, SC
--
Dave
Temping with Staffmark
in Rock Hill, SC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Naming conventions for variables

Give this a quick once over...

http://support.microsoft.com/kb/110264
--
HTH...

Jim Thomlinson


"Dave Birley" wrote:

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 a

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.
--
Dave
Temping with Staffmark
in Rock Hill, SC
--
Dave
Temping with Staffmark
in Rock Hill, SC

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Naming conventions for variables

There's no standard.

There are some suggestions that seem to be rather widely followed. For
an example, see the pages around

http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

I use an idiosyncratic version of that style, though I find I can follow
nearly any consistent convention.

In article ,
Dave Birley wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Naming conventions for variables

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" wrote:

Give this a quick once over...

http://support.microsoft.com/kb/110264
--
HTH...

Jim Thomlinson


"Dave Birley" wrote:

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 a

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.
--
Dave
Temping with Staffmark
in Rock Hill, SC
--
Dave
Temping with Staffmark
in Rock Hill, SC

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Naming conventions for variables

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!
--
Dave
Temping with Staffmark
in Rock Hill, SC


"JE McGimpsey" wrote:

There's no standard.

There are some suggestions that seem to be rather widely followed. For
an example, see the pages around

http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

I use an idiosyncratic version of that style, though I find I can follow
nearly any consistent convention.

In article ,
Dave Birley wrote:

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File naming conventions gidget Excel Discussion (Misc queries) 7 November 15th 05 02:15 PM
plotting 2 variables as scatter and naming each point Jane Charts and Charting in Excel 1 June 22nd 05 03:55 PM
Naming Range Variables scott Excel Programming 6 January 7th 05 10:37 PM
Naming Variables Terri[_5_] Excel Programming 1 October 11th 04 04:16 PM
naming multiple public variables generated by single function Mark Kubicki Excel Programming 1 July 22nd 03 09:25 PM


All times are GMT +1. The time now is 07:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"