'********************************************************************

'*

'* Function Dec2Bin

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2004-11-22

'* Modified: 2004-11-22

'*

'* Purpose: Converts a decimal to a binary string.

'*

'* Input:   intAny    Any Integer

'*

'* Output:  Returns a string of the Binary (0,1) representation

'*            of the decimal number.

'*

'********************************************************************

Function Dec2Bin(ByVal intAny)

  'Version 1.0 2004-11-22

  strTemp = ""

  Do While intAny > 0

    If intAny Mod 2 > 0 Then

      strTemp = "1" & strTemp

    Else

      strTemp = "0" & strTemp

    End If

    intAny = Int(intAny / 2)

  Loop 'intAny > 0

  If Len(strTemp) = 0 Then

    strTemp = "0"

  End If 'Len(strTemp) = 0

  Dec2Bin = strTemp

End Function 'Dec2Bin

Article ID: 385, Created On: 9/25/2011, Modified: 9/25/2011