AHI TIENES ESTA FUNCION:
Function sBankControlDigit(Bank As Variant, SubBank As Variant, Account As Variant) As String
Dim sBank As String
Dim sSubBank As String
Dim sAccount As String
Dim Cuenta As String
Dim Temporal As Integer
Dim i As Integer
sBank = Format(Bank, "0000")
sSubBank = Format(SubBank, "0000")
sAccount = Format(Account, "0000000000")
If IsNull(Account) Then
Else
For i = 1 To 10
If Mid(Account, i, 1) = "." Then
sBankControlDigit = "**"
Exit Function
End If
Next
Cuenta = sAccount
End If
On Error GoTo ControlErrores
Temporal = 0
Temporal = Temporal + Mid(sBank, 1, 1) * 4
Temporal = Temporal + Mid(sBank, 2, 1) * 8
Temporal = Temporal + Mid(sBank, 3, 1) * 5
Temporal = Temporal + Mid(sBank, 4, 1) * 10
Temporal = Temporal + Mid(sSubBank, 1, 1) * 9
Temporal = Temporal + Mid(sSubBank, 2, 1) * 7
Temporal = Temporal + Mid(sSubBank, 3, 1) * 3
Temporal = Temporal + Mid(sSubBank, 4, 1) * 6
Temporal = 11 - (Temporal Mod 11)
If Temporal = 11 Then
sBankControlDigit = "0"
ElseIf Temporal = 10 Then
sBankControlDigit = "1"
Else
sBankControlDigit = Format(Temporal, "0")
End If
Temporal = 0
Temporal = Temporal + Mid(sAccount, 1, 1) * 1
Temporal = Temporal + Mid(sAccount, 2, 1) * 2
Temporal = Temporal + Mid(sAccount, 3, 1) * 4
Temporal = Temporal + Mid(sAccount, 4, 1) * 8
Temporal = Temporal + Mid(sAccount, 5, 1) * 5
Temporal = Temporal + Mid(sAccount, 6, 1) * 10
Temporal = Temporal + Mid(sAccount, 7, 1) * 9
Temporal = Temporal + Mid(sAccount, 8, 1) * 7
Temporal = Temporal + Mid(sAccount, 9, 1) * 3
Temporal = Temporal + Mid(sAccount, 10, 1) * 6
Temporal = 11 - (Temporal Mod 11)
If Temporal = 11 Then
sBankControlDigit = sBankControlDigit + "0"
ElseIf Temporal = 10 Then
sBankControlDigit = sBankControlDigit + "1"
Else
sBankControlDigit = sBankControlDigit + Format(Temporal, "0")
End If
If Len(Trim(Cuenta)) < 10 Then
sBankControlDigit = "**"
Exit Function
End If
For i = 1 To 10
If Mid(Cuenta, i, 1) = "-" Or Mid(Cuenta, i, 1) = "." Then
sBankControlDigit = "**"
Exit Function
End If
Next
Exit Function
ControlErrores:
sBankControlDigit = "**"
End Function