VBA code for formatting phone numbers

Solved
jc80 Posted messages 5063 Registration date   Status Member Last intervention   -  
jc80 Posted messages 5063 Registration date   Status Member Last intervention   -
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. jc80 Posted messages 5063 Registration date   Status Member Last intervention   1 443
     
    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
    0
  2. Kuartz Posted messages 852 Registration date   Status Member Last intervention   65
     
    Hello,

    Take inspiration from this code:

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


    Best regards.
    -1
  3. jc80 Posted messages 5063 Registration date   Status Member Last intervention   1 443
     
    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
    -1