Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
#73214
Senhores tentei e continuo tentando formatar uma caixa de Textbox para que após digitar 7 números surja "-" para depois digitar mais números (ex: 000100-23), sendo que eu digitaria somente os números (ex: 000010023), segue abaixo uma da minhas tentativas, eu errei tudo ou o que deve ser corrigido?
Private Sub Txt_NºProcesso_Cob_Change()
On Error GoTo Erro
On Error Resume Next
If tecla = 8 Then
Exit Sub
End If
Format (Me.Txt_NºProcesso_Cob.Value = "0000000-00")

If Len(Txt_NºProcesso_Cob.Value) = 7 Then
Me.Txt_NºProcesso_Cob.Value = Txt_NºProcesso_Cob.Value & "-"
Me.Txt_NºProcesso_Cob.Value.SelStart = 4
ElseIf Len(Txt_NºProcesso_Cob.Value) = 5 Then
Me.Txt_Cliente_Cob.SetFocus
End If

Exit Sub
Erro:
MsgBox "Erro!", vbCritical, "FORMATAR"

End Sub
#73215
Bom dia.
veja se serve.
Private Sub Txt_NºProcesso_Cob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Not IsNumeric(Chr(KeyAscii.Value)) Then
'If Not IsNumeric(Chr(KeyAscii.Value)) Or Len(Txt_NºProcesso_Cob.Text) >= 10 Then PARA LIMITAR EM MAIS DOIS NUMEROS APÓS O -
KeyAscii.Value = 0
Else
If Len(Txt_NºProcesso_Cob.Text) = 7 Then
Txt_NºProcesso_Cob.Text = Txt_NºProcesso_Cob.Text & "-"
End If
End If
End Sub

Até
Foxtri
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord