1
Private Sub txtData_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) 'Limita a Qde de caracteres txtData.MaxLength = 8 'para permitir que apenas números sejam digitados If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0 End If End Sub Private Sub txtData_Change() 'Formata : dd/mm/aa If Len(txtData) = 2 Or Len(txtData) = 5 Then txtData.Text = txtData.Text & "/" SendKeys "{End}", True End If End Sub

Formata Datas Em Vba

Embed Size (px)

DESCRIPTION

hehehe

Citation preview

Page 1: Formata Datas Em Vba

Private Sub txtData_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)'Limita a Qde de caracterestxtData.MaxLength = 8

'para permitir que apenas números sejam digitadosIf KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then

KeyAscii = 0End If

End Sub Private Sub txtData_Change()

'Formata : dd/mm/aaIf Len(txtData) = 2 Or Len(txtData) = 5 Then

txtData.Text = txtData.Text & "/"SendKeys "{End}", True

End IfEnd Sub