I am creating an application that will generate a letter set based on a specified number, where 2 = a, 27 = z, 28 = aa, 53 = az, so forth and so on, up to at least zz, but possibly up to 8-digits (i.e. azzzzzzzz-zzzzzzzz).

What I would like to do is use a function that will allow me to input the number that corresponds to the letter set and have it return the corresponding letter set. This function will probably be recursive, and rely on a mathematical equation. I have worked with it a bit, but cannot seem to come up an equation that will work 100%.

Here are the functions I am working with (original code from http://www.delphi.com/ab-visualbasic...s/?msg=988.3), but it only works up to zz, and has a problem calculating y and z (doesn't return y or z, but ? or @ respectively).

Public Function Letter(num As Integer) As String Letter = Chr(num Mod 26 + 63) End Function

Public Function Letters(num As Integer) As String If Int(num / 26) > 1 Then Letters = Letters(Int(num + 26 / 26)) & Letter(num) Else Letters = Letter(num) End If End Function

Inputting the number 678 (e.g. Letters(678)) should return string "za".

If you are able to help, you can send an email to me at [email protected]

Thanks, Greg