By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Advice on VBA Comment Style

P: n/a
Hi there,

I'm trying to sharpen up my commenting in my code, partly for my own
sake and partly for any inheritors of my code. I'm particularly
wondering what comments are recommended for the beginning of each
procedure.

Can you point me to a site that gives advice on good commenting style,
or post some pearls of your own wisdom? My searches in the
newsgroup/mvps.org/google didn't go too well - searching for "comments"
casts the net rather too wide! :-)

-------
LoopyNZ
-------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Not sure there is much of a standard, but the minimum would be:
'Purpose: Avoid division by zero error.

If a function, explain what it returns:
'Return: Result of division, or zero in place of error or null.

If it accepts arguments, an explanation of each:
'Arguments: Num1 = numerator
' Num2 = denominator

If usage is not obvious, give an example of how it is used:
'Usage: Set AfterUpdate event of form to:
' Call NotifyCombos(acDeleteOk)
' and AfterDelConfirm event of form to:
' Call NotifyCombos(Status)

If there is something odd about how the procedure works, you may want to
explain the method:
'Method: Handles #1/1/9999# as last effective date.

If there is somehing odd about what it depends on note that also:
'Dependency: Requires functions from our ExtraLib.mda file.

In a multi-user environment, you may also want to specify the author, though
it may be better to keep each author's work in different modules.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"LoopyNZ" <Lo*****@NOguruSPPAM.net.nz> wrote in message
news:41**********************@news.newsgroups.ws.. .
Hi there,

I'm trying to sharpen up my commenting in my code, partly for my own
sake and partly for any inheritors of my code. I'm particularly
wondering what comments are recommended for the beginning of each
procedure.

Can you point me to a site that gives advice on good commenting style,
or post some pearls of your own wisdom? My searches in the
newsgroup/mvps.org/google didn't go too well - searching for "comments"
casts the net rather too wide! :-)

Nov 13 '05 #2

P: n/a
LoopyNZ <Lo*****@NOguruSPPAM.net.nz> wrote:
I'm particularly
wondering what comments are recommended for the beginning of each
procedure.


I include the following:

Author
Date
Purpose
Comments

Also include embedded comments as appropriate

Regards,
Keith.
www.keithwilby.org.uk
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.