devxlogo

Change a Decimal based number to a Binary Number without using the Excel Object

Change a Decimal based number to a Binary Number without using the Excel Object

Excel offers the functions, but who wants to add the Excel object model to their project? One simple way is to use the OCT command and a little conversion to change Decimal based code to Binary.

 Public Function ToBinary(ByVal lngDecimalNumber As Long) As String    Dim strDecimalNumber            As String    Dim strReturnValue              As String    Dim strBinValue                 As String    Dim lngStringLength             As Long    Dim lngIndex                    As Long    strDecimalNumber = Oct(lngDecimalNumber)    lngStringLength = Len(strDecimalNumber)    For lngIndex = 1 To lngStringLength        Select Case Mid$(strDecimalNumber, lngIndex, 1)        Case 0            strBinValue =
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist