| << 9.3.1- Indent Your Code | Chapter9 | 9.3.3- Use Option Explicit >> |
Comment Your Code
This one is very simple. If you write code, then you can't expect anyone else tounderstand it (even yourself a few weeks on) unless you comment it thoroughly.Use the single quotation mark to add a comment. Sensible places for commentsare after variable or procedure declarations, to explain what each part does::
Dim strTextBox 'Text Boxcontaining users name stored here
Comments are also useful after loops, to indicate what isbeing repeated, or after Else and End If to indicate whatdecision is being taken by that branch of the code:
If varQuestion = "Fax" Then 'If user selectsfax then initiate fax confirmation
...code...
ElseIf varQuestion = "Email" 'If user selectsemail then initiate email confirmation
...more code...
Else 'Don't send userconfirmation
...yet more code...
End If 'End of confirmationdecision tree
| << 9.3.1- Indent Your Code | Chapter9 | 9.3.3- Use Option Explicit >> |

RSS
