Return tag of dynamic commandbutton as string

  • Hi everybody,

    I use following code to show names of users on a form:



    When one of these buttons gets clicked, I want its tag/name/caption to be stored in a string (called User).
    Can anybody help?

  • Re: Return tag of dynamic commandbutton as string


    In a standard module add this at the top:

    Code
    Public Usr As String

    then in your userform:

    Code
    Private Sub CommandButton1_Click()
    Usr = Me.Commandbutton1.Caption
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!