Com essa função é possível fazer a validação do número do PIS/PASEP passado por parametro.
A função retorna True para quando o número é verdadeiro e False para um número inválido.
11 Then IsPISPASEP = False Exit Function End If For intCont = 1 To 10 intResultado = Mid(strPISPASEP, intCont, 1) * Mid(strPeso,intCont, 1) intTotal = intTotal + intResultado Next 'Resto da Divisao intResto = intTotal Mod 11 If intResto <> 0 Then intResto = 11 - intResto End If If intResto = 10 Or intResto = 11 Then intResto = Mid(intResto, 2, 1) End If If Cint(intResto) <> Cint(Mid(strPISPASEP, 11, 1)) Then IsPISPASEP = False Exit Function End If IsPISPASEP = True End Function %> Testando o código:
O PISPASEP está Correto! O PISPASEP está Incorreto!