Code:
Function ProvjeraB(BrojA As String) As Boolean
Dim K(8) As Integer
Dim G As Integer
Dim I As Integer
On Error GoTo Greska
If Len(BrojA) <> 8 Then
K(0) = 11
GoTo Greska
End If
For I = 1 To 8
K(I) = Mid(BrojA, I, 1)
If I < 8 Then
K(0) = K(0) + K(I) * (9 - I)
End If
Next I
K(0) = K(0) Mod 11
If K(0) < 1 Or K(0) > 11 Then GoTo Greska
K(0) = 11 - K(0)
If K(0) = 10 Then K(0) = 0
If K(0) <> K(8) Then
K(0) = 0
GoTo Greska
End If
ProvjeraB = True
Izlaz:
Exit Function
Greska:
ProvjeraB = False
GoTo Izlaz
End Function
zxz