VBA code for formatting phone numbers

Solved
Hello,

Could you please tell me what code I need to put in a textbox to
get a phone number format?
Thank you for your help
Best regards

Configuration: Windows 7 / Firefox 38.0

3 answers

  1. The response below
    it works
    Private Sub T_numerodetelephone_Change()
    Dim Text As String
    Text = T_numerodetelephone.Text
    Select Case Len(Text)
    Case 2, 5, 8, 11
    Text = Text & "/"
    End Select
    T_numerodetelephone.Text = Text

    End Sub
    Best regards
    1. Hello,

      Take inspiration from this code:

      TextBox1.Text = Format(Cell.value, "0# ## ## ## ##")


      Best regards.
      1. Hello
        Thank you for your response
        It's not working, there's a bug on the first line below
        Code that I put in the textbox
        Private Sub T_numerodetelephone_Change()
        T_numerodetelephone.Text = Format(T_numerodetelephone.Value, "0# ## ## ## ##")
        End Sub
        Best regards