difference between ! and . character in the syntax of the VBA identifieer "Form" and "me" RRS feed

  • Question

  • Hi there,
    Greetings from Shank. Am new to the forum.

    I am in the process of developing a VBA app. The thing is I don't know the difference between the following vb statements. They all behave the same way (i.e copy  the contents the Left Text Box to the Right one. Can you tell me what the "!" exclamation mark does when compared to "." dot character. Can I use them Interchangeably.
    Private Sub CommandButton1_Click()
    Me.TextBox2 = Me.TextBox1
    Me!TextBox4 = Me!TextBox3
    form.TextBox6 = form.TextBox5
    form!TextBox8 = form!TextBox7

    End Sub
    Sub displayform()
    Dim frm As New UserForm1
    Unload frm
    Set frm = Nothing
    End Sub
    Monday, September 28, 2020 9:19 AM

All replies

  • See Member Access Operators for the difference.

    You can use the exclamation mark for "late bound" objects where the properties & methods aren't knowing during development time, see Using early binding and late binding in Automation

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Monday, September 28, 2020 9:39 AM
  • thanks for the repy man. I appreciate it. I searched all over the net but couldn't find it, until now
    Monday, September 28, 2020 9:57 AM
  • Hi shank1985,

    You can also consider posting your question in VBA forum for more efficient responses. 

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao 

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 29, 2020 8:47 AM