**Public Function NumberToBaseX( _
ByVal vNum As Variant _
, Optional ByVal vBase As Variant _
) As Variant**

**Convert a long integer to a string representing the number in a different number base. **

**Examples:** NumberToBaseX(1234, 2) = "10011010010"
NumberToBaseX(1234, 8) = "2322"
NumberToBaseX(1234, 16) = "4D2"
NumberToBaseX(1234, 36) = "YA"
NumberToBaseX(-1234, 8) = "-2322" ' #5
NumberToBaseX(123456789, 2) = "111010110111100110100010101"
NumberToBaseX(123456789, 8) = "726746425"
NumberToBaseX(123456789, 16) = "75BCD15"
NumberToBaseX(123456789, 36) = "21I3V9"

**See also:** BaseXToNumber Function
BaseXToLong Function
ExcelColumnNumberToLetters Function
Hex$ Function (Visual Basic)
Oct$ Function (Visual Basic)

**Summary:** This function can convert a number to any base between 2 and 36. Use base 2 for binary numbers, base 8 for octal numbers, base 10 for decimal numbers, base 16 for hexadecimal numbers, and base 36 for alphanumeric numbers. **vNum:** The base-10 number that is to be converted to a base between 2 and 36. Function returns Null if vNum is Null or cannot be fixed up to a number.

**vBase:** The base to which vNum will be converted then returned as a string. vBase defaults to 10 (ten) if it is missing or Null or cannot be fixed up to a number (that would be similar to calling the Visual Basic CStr function).

**Return value:** This function may return a string which begins with a minus sign ("-") indicating that vNum was negative as in example #5.

Copyright 1996-1999 Entisoft

Entisoft Tools is a trademark of Entisoft.