Consulting

Results 1 to 2 of 2

Thread: Getting values from a textbox in a userform

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,776
    You could put this in the userform's code module
    Private Sub CommandButton1_Click()
        Me.Hide
    End Sub
    and call the userform with code like
    Sub test()
        Dim uiValue As String
        UserForm1.Show
        uiValue = UserForm1.TextBox1.Text
        Unload UserForm1
        If uiValue = vbNullString Then
            MsgBox "user entered nothing"
        Else
            MsgBox "user entered " & uiValue
        End If
    End Sub
    Last edited by Aussiebear; 07-08-2025 at 03:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •