Public Function OctBin(lngOctal As Long) As String
Dim lngQout As Long
Dim strTmp As String
Dim strTemp As String
Dim i As Integer
Dim j As Integer
intl = Len(lngOctal)
For i = intl To 1 Step -1
lngQout = Mid(lngOctal, i, 1)
Do Until lngQout = -1
If (lngQout Mod 2) = 0 Then
strTmp = 0 & strTmp
Else
strTmp = 1 & strTmp
End If
lngQout = Int(lngQout / 2)
If lngQout = 0 Then
strTemp = strTmp & strTemp
For j = 1 To 3 - Len(strTmp) Step 1
strTemp = 0 & strTemp
Next
strTmp = ""
lngQout = -1
End If
Loop
Next
OctBin = Val(strTemp)
End Function
例:输入 OctBin (1024) 转换出来的结果就是二进制:1000010100。