Comment in the Procedure

Function GetUserName
'Prompts the user for his name. If the user refuses to provide
'his name five times, we give up and return a zero-length string.
Dim UserName
Dim TryAgain
Dim LoopCount
LoopCount = 1
TryAgain = "No"
UserName = InputBox("Please enter your name:")
UserName = Trim(UserNAme)
If UserName = " " Then
If LoopCount > 5 Then
UserName = " "
TryAgain = "No"
MsgBox "You must enter your name."
TryAgain = "Yes"
End If
LoopCount = LoopCount + 1
Loop While TryAgain = "Yes"
GetUserNAme = UserNAme
End Function

We also added a comment to the beginning of the procedure to describe what it does. Notice that the comment does not describe how the function does what it does, only what it does. The code that uses this function does not care how the function accomplishes its task - it only cares about inputs, outputs, and predictability. It is very important that you add comments such as this to the beginning of your procedure, since they make it easy to determine what the function does. This comment also performs one other valuable service to you and any other developer who wants to call this function: it mentions that the function may return an zero-length string if the user does not enter his name. It is important that a programmer knows the possible range of return values so they can right code to deal with those contingencies.