Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:00:17+00:00 2026-06-13T09:00:17+00:00

I have userform which collects some user input. Now what I’m trying to do,

  • 0

I have userform which collects some user input. Now what I’m trying to do, is to declare some event to throw from userform when OK button is clicked. I’m new to vba so I don’t know how to do it. Any code or link to tutorial would be greatly appreciated.

Load UserForm1
UserForm1.Show
//here I want to capture UserForm1 OK button's click event and read the data
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:00:18+00:00Added an answer on June 13, 2026 at 9:00 am

    As I said in a comment, I don’t think what you want to do is possible, but I thought of the following workarounds:

    1. If your user input is very simple, like just entering a string, a messagbox could work:

      Dim sUserInput As Variant
      
      sUserInput = InputBox("Please enter something useful.", "Title", "Default")
      
      Debug.Print "sUserInput=" & sUserInput
      
    2. If you need the form to capture user input, making it modal and then exposing a value through a public method might work.

      In the form:

      Option Explicit
      
      Private msFormString As String
      
      Private Sub CommandButton1_Click()
          msFormString = "Someone clicked on Button 1!"
      
          '***** Note: if you use Unload Me, the string
          '***** is unloaded with the form...
          Me.Hide
      End Sub
      
      Public Function GetFormString() As String
          GetFormString = msFormString
      End Function
      

      The calling code:

      Load UserForm1
      Call UserForm1.Show(vbModal)
      Debug.Print "Value from UserForm1: " & UserForm1.GetFormString
      

      Note: The function could return an object, class or array if you need to pass more data back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel2010 VBA userform that has one comboBox, from which the user
I have created a Userform that lets the user pick a worksheet from a
I have a UserForm class which has a select list populated from a related
I made a Sheet which I have now converted to a UserForm but the
I have created a UserForm where the user is required to fill-in three fields.
I have two classess and a Userform. I am trying not to use any
I have a template which allows the user to edit their user information. <form
I have an MS Access database on a network drive with a userform which
I have User form in which there is a username field. The fields in
i have an user form which he has to fill before moving on to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.