I need your help translating this Excel VBA function into StarOffice VBA.
Basically, it checks if an IBAN code (banking account number used in Europe and elsewhere) is valid.
Examples are:
DE89370400440532013000
IT23Q0542801602000000009390
A problem I know is that StarOffice VBA doesn't have the LIKE operator. Is there a way to "simulate" it?
Apart from this, I also have problems with the rest of the function...
Any help would be highly appreciated, thank you very much!
Code: Select all
Function IsFormatIBAN(ByVal S As String) As Boolean
Dim X As Long, DigitValue As Long, Total As Long
If Not S Like "*[0-9A-Z ]*" Then Exit Function
S = Replace(S, " ", "")
S = Mid(S, 5) & Left(S, 4)
For X = 65 To 90 'A to Z
S = Replace(S, Chr(X), X - 55)
Next
S = StrReverse(S)
DigitValue = 1
Total = Left(S, 1)
For X = 2 To Len(S)
DigitValue = 10 * DigitValue Mod 97
Total = Total + Mid(S, X, 1) * DigitValue
Next
IsFormatIBAN = (Total Mod 97) = 1
End Function