Here’s a function for adding leading zeros to a number. I have it set to add up to five zeros:
Public Function LdgZero(ByVal x)
If x < 10 Then
x = “00000″ & x
ElseIf x >= 10 And x < 100 Then
x = “0000″ & x
ElseIf x >= 100 And x < 1000 Then
x = “000″ & x
ElseIf [...]

