+ Reply to Thread
Results 1 to 13 of 13

How to create dynamic userform or dialog box

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    How to create dynamic userform or dialog box

    I wanted to create a userform that is dynamic. Let me explain.

    A teacher is going to give a test. The teacher is going to give two versions of the test. Each test may or may not have the same number of problems.

    I want to create a userform that asks how many tests and problems per test. Then, ideally, on the same userform after input the number of tests and problems a list would be created asking the number of possible points for each problem.

    The list would ask what the possible number of points are for each problem kinda like the list below. Of couse each col would be labeled but did not do it here.

    Test1_Problem1 50
    Test1_Problem2 50
    Test2_Problem1 50
    Test2_Problem2 50

    The list would be dynamic in the sense that you dont know how many tests or problems are going to be needed? Does this make sense what i am asking? Is it even possible?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to create dynamic userform or dialog box

    It's possible, but complicated
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    ok.....

    how would you recommend that i get the input from the user on the possible points per problem?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: How to create dynamic userform or dialog box

    Here's a rough demo of how to go about it.
    Attached Files Attached Files
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    is there a way to "pass" the number of problems to the userform? I can get input from the user on how many tests and problems per tests........then i can pass the total number of problems tothe user form and have it create the desired number of entries instead of having user input the number of entries.

    by the way...........very nice what you sent .......

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    also, how do i get the data out of the userform? where is it being stored and how do i get it back to my main program?

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: How to create dynamic userform or dialog box

    You said there could be a different number of problems per test, which is why I made the demo the way it is.
    Also, it is just that - a demo. I have no idea of how your application works so I don't know what you plan to do with the data - that bit is up to you!

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    hi,

    and thanks for the demo.

    I guess what i am asking is "how to transfer" the number of problems to the "userform"?

    Once userform is displayed and user types in the appropriate values in each box......how do i get the data?

    I am not sure how to transfer the data back to my program so i can access it. Does this make sense?

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: How to create dynamic userform or dialog box

    The userform asks how many tests, how many problems per test, then prompts for a score for each question - is that not what you asked for?
    To get the data back you need a loop through the controls on page 2 of the multipage, check if each is a textbox and return the value. They are all named in the format TestxQuestiony so you know what they relate to.

  10. #10
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    hi,

    yes that is what i asked for.

    But inaddition, how do you pass variables to the userform.

    Also, i am still not clear on how to get the data from the userform to my program. I am sorry, i guess i am not as good as i had hoped.

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: How to create dynamic userform or dialog box

    You can fill in the textboxes before showing it using code like:
    Please Login or Register  to view this content.
    and to return the data, add a button to the second page and use code like:
    Please Login or Register  to view this content.
    This will report the values in a series of messageboxes - you'll need to adjust it to put them wherever you like.

  12. #12
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    I must admit. I have not programmed with userforms that much. I can program ok......but boy....they syntax you have in this is almost foreign to me. There is much to learn.

    Thanks again.

    Just one more comment.

    What i was hoping to do is pass an array or something to the user form , fill the array with the possible points, then pass the array back to the main program........how would one do this? If you dont have time to answer i understand............thanks for what you have done.

    i can tell your really good at this stuff......

  13. #13
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to create dynamic userform or dialog box

    also, when you say "2nd" page......where is the 2nd page?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1