En un post que puso Death encontre una función de verificación del numero R.U.T usado en Chile.
La he adaptado a la notación que uso en el proecto GEF y ha quedado así.
Public Function VRUTChile(strRutIn As String, strDigRut As String) As Boolean
'Propuesta por DEATH y modificado por Tincho
'https://foro.gambas-es.org/viewtopic.php?f=5&t=85
Dim intPlus As Integer
Dim intLen As Integer
Dim intConstant As Integer
Dim strRutOut As String
Dim strRutTmp As String
Dim intDigit As Integer
Dim strDigit As String
Dim bolValid As Boolean
strDigit = ""
intConstant = 1
intLen = Len(Trim(strRutIn))
strRutTmp = Val(Trim(strRutIn))
Do Until intLen = 0
intConstant = intConstant + 1
intPlus = intPlus + Mid(strRutTmp, intLen, 1) * intConstant
If intConstant = 7 Then
intConstant = 1
End If
intLen = intLen - 1
Loop
intDigit = intPlus Mod 11
strDigit = Str(11 - intDigit)
If Val(strDigit) = 11 Then
strDigit = "0"
End If
If Val(strDigit) = 10 Then
strDigit = "K"
End If
If Trim(strDigit) <> Trim(strDigRut) Then
bolValid = False
Else
bolValid = True
End If
Return bolValid
End
'Propuesta por DEATH y modificado por Tincho
'https://foro.gambas-es.org/viewtopic.php?f=5&t=85
Dim intPlus As Integer
Dim intLen As Integer
Dim intConstant As Integer
Dim strRutOut As String
Dim strRutTmp As String
Dim intDigit As Integer
Dim strDigit As String
Dim bolValid As Boolean
strDigit = ""
intConstant = 1
intLen = Len(Trim(strRutIn))
strRutTmp = Val(Trim(strRutIn))
Do Until intLen = 0
intConstant = intConstant + 1
intPlus = intPlus + Mid(strRutTmp, intLen, 1) * intConstant
If intConstant = 7 Then
intConstant = 1
End If
intLen = intLen - 1
Loop
intDigit = intPlus Mod 11
strDigit = Str(11 - intDigit)
If Val(strDigit) = 11 Then
strDigit = "0"
End If
If Val(strDigit) = 10 Then
strDigit = "K"
End If
If Trim(strDigit) <> Trim(strDigRut) Then
bolValid = False
Else
bolValid = True
End If
Return bolValid
End
Si alguno puede verificarla seria interesante así la incorporarla a la colección de funciones.
Saludos.