Máscara de CNPJ/CPF em Textbox
Galera, boa noite.
Estou tentando formatar um campo textbox, mas tá dando erro, alguém sabe pq?
>
Private Sub txtCNPJCPF_LostFocus()
If Len(txtCNPJCPF.Text) = 14 Then
txtCNPJCPF.Text = Format(txtCNPJCPF.Text, "00.000.000/0000-00")
ElseIf Len(txtCNPJCPF.Text) = 11 Then
txtCNPJCPF.Text = Format(txtCNPJCPF.Text, "000.000.000-00")
Else
MsgBox "Formato inválido, verifique!", vbCritical
End If
End Sub
Por exemplo, se eu digitar: 12345678000120, ele formata: 12345678000120,000.000/0000-00
Obrigado
Ricardo
Discussão (2)
Carregando comentários...