Tengo esta función que pretende convertir de octal a decimal. El problema es que siempre da 0 y no se como corregirla.
Public Function OctToDec(ByVal octal As Long) As Integer
Dim DecNum As Integer
Dim digito As Integer
Const DIVISOR As Integer = 10
Dim i As Long
Dim octal As Long
Dim j As Long
j = 0
i = octal
numero = 0
digito = 0
For i = octal To 0 Step -1
i = i \ DIVISOR
If Not (digito >= 0 And digito <= 7) Then
Exit Sub
End If
digito = CInt(i) Mod DIVISOR
j = j + 1
DecNum = DecNum + digito * CInt(8 ^ j)
Next
OctToDec = DecNum
End Function
i = i \ DIVISOR
. Debes encontrar otra manera de descomponer el número octal dado en cada uno de sus dígitos.