[mso] Re: VBA Naming Convention User Preference

I like to know where the variable is coming from so I use..

l = Local to that subroutine.
g = Global.. I put all my globals in a seperate module.
p = A parameter of the function/subroutine.
i = integer.
s = string.

slVariable would be a string variable defined locally.
ipVaraible would be an integer defined in the parameters of the call.

... And so on.

I used to use stuff lik glb and int and str and so on but got lazy :-)

As Bear says though... There aint no hard and fast rules. If it works for
you then that's the way to go... But it is a good idea to look at the whys
and wherefores of people who've been at it some time.

Those are good links from Bear and well worth checking out.

There is a *lot* of stuff out there about variables and naming conventions.

HTH
Lisa

>  Hi Lisa
> I notice that to name your variables you use eg rlCell as 
> Range which i make out to be "r" for range what's the "l" for 
> and there others you normally adopt as some sort of naming 
> convention and more importantly why!.  Maybe Linda could run 
> an enquiry to see what sort of conventions users are using. 
> I use as below, hope the table comes out properly.
> Rgds
> KZ
> VBA Naming Convention
> 
> 
> Object 
> 
> Convention 
> 
> preferred 
> 
> example 
> 
> Integer 
> 
> % or i or c or int 
> 
> % 
> 
> integer% or intIntegerName 
> 
> long 
> 
> &or l or c or lng 
> 
> &
> 
> long& or lngLongName 
> 
> single 
> 
> ! or s or sng 
> 
> ! 
> 
> single! or sngSingleName 
> 
> double 
> 
> # or d or dbl 
> 
> # 
> 
> double# or dblDoubleName 
> 
> currency 
> 
> @ or cur 
> 
> @ 
> 
> currency@ or curCurrencyName 
> 
> string 
> 
> $ or s or str 
> 
> $ 
> 
> string$ or strStringName 
> 
>   
> 
>   
> 
>   
> 
>   
> 
> variant 
> 
> v or var 
> 
> var 
> 
> varVariant 
> 
> date 
> 
> dt 
> 
> dt 
> 
> dtDate 
> 
> boolean 
> 
> b or f 
> 
> bln 
> 
> blnBoolen 
> 
> byte 
> 
> b or bt 
> 
> byt 
> 
> bytByte 
> 
> user defined type 
> 
> u or ut 
> 
> udt 
> 
> udtUserDefinedType 
> 
>   
> 
>   
> 
>   
> 
>   
> 
> range 
> 
> rng 
> 
> rng 
> 
> rngRange 
> 
> workbook 
> 
> wb or wbk 
> 
> wbk 
> 
> wbkWorkbook 
> 
>   
> 
>   
> 
>   
> 
>   
> 
> worksheet 
> 
> ws or wks 
> 
> wks 
> 
> wksWorksheet 
> 
> chart 
> 
> ch or chrt 
> 
> chrt 
> 
> chrtChart 
> 
> pivot table 
> 
> pt or pvt 
> 
> pvt 
> 
> pvtPivotTable 
> 
> font 
> 
> fnt 
> 
> fnt 
> 
> fntFont 
> 
>   
> 
>   
> 
>   
> 
>   
> 
> global variable 
> 
> g or glb 
> 
> glb 
> 
> glbGlobalName 
> 
>   
> 
>   
> 
>   
> 
>   
> 
> constant variable 
> 
> CONSTANT 
> 
> All Caps 
> 
> CONSTANTNAME 



*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister group. 
 This group will not allow for posting of emails, but will allow you to join 
and share problem files, templates, etc.:  
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE 
SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: