Function ConvertBase(ByVal intNumberToConvert As Integer, ByVal intBase) As String Dim strOutput As String Dim intDigit As Integer Dim strDigit As String Dim blnNegative As Boolean ' We run out of letters if trying to convert to a base > 36 so don't let the user do it If intBase > 36 Then ConvertBase = 0 Exit Function End If If intNumberToConvert < 0 Then intNumberToConvert = -1 * intNumberToConvert blnNegative = True End If While intNumberToConvert <> 0 intDigit = intNumberToConvert Mod intBase If intDigit <= 9 Then strDigit = Str$(intDigit) Else strDigit = Chr$(intDigit + 55) End If intNumberToConvert = (intNumberToConvert - intDigit) / intBase strOutput = Trim(strDigit) & strOutput Wend If blnNegative Then strOutput = "-" & strOutput End If ConvertBase = strOutput End Function