private sub dig_keypress(keyascii)
' dig (txtdig), rut (txtrut), tambien faltan declarar algunas variables
' y option explicit, pero funciona igual.
' este codigo te permite que al ingresar el digito verificador lo acepte o no.
' ojala te sirva. atte. hussein anselmi
'
husseinanselmi@yahoo.es
r = len(trim(txtrut))
a = 2
for i = r to 1 step - 1
c = val(mid(txtrut,i,1))*2
if a = 8 then
a = 2
end if
a = a +1
s = s + c
next i
resto = s mod 11
dig = str(11 - resto)
if dig = "10" then
dig = "0"
end if
if dig = "11" then
dig = "K"
end if
if dig= ucase(chr(keyascii) then
msgbox" ingreso bien el rut"
else
msgbox "error!!!"
end if
end sub