PDA

View Full Version : Bitten off more than I can chew.



seanburns76
10-01-2013, 12:24 PM
Hello All, I'm somewhat of a newbie to VBA and feel I understand the logic of most scripts I see, but am having a little problem with a project I currently have. I need to create a dynamic form for employees to fill out. I need for a button to create new consecutive textboxes(placed directly below the previously created box) when the "Add Textbox" button is pushed. Put simply, ...push button and you get one box, push it again and you get a second box right below the first. I feel like a moron placing this thread, but am somewhat desperate and have a heavy breathing boss!! I would appreciate any help!!! Thanks

Kenneth Hobs
10-01-2013, 12:48 PM
Welcome to the forum!

Unfortunately, forum help can be slow if at all, though at times, very fast and more than one way to do it. IF you need fast, hire a consultant. Help is often dependent on the degree of help needed.

The best way to get help is for you to help us help you. That is tyically done by attaching a file(s) or sheet(s) with examples of before and after.

seanburns76
10-01-2013, 01:05 PM
Thanks for the reply Kenneth. I'm kind of new to the organization and was looking to this as being the first feather in my cap. That said, if it gets to a point where I feel its too far beyond my skillset within the time frame given, I'll tell my boss it's a no go and ask for the consultation(most likely in house, but billable). I believe I can make it happen, I just need a couple of strong discovery pushes to get some momentum. I'll trudge on. I don't have any before or after files, per se, but have the simple idea of what I want to action through the code.

SamT
10-02-2013, 04:14 PM
"Can you explain what are you trying to do, and not how you think you want to do it?"
Paul H. (http://www.vbaexpress.com/forum/showthread.php?47641-INDIRECT%28%29-function-doesn-t-work-quot-Can-t-Find-Object-or-Library-quot&p=297932&viewfull=1#post297932)

Hey Sean,

Now that we know how you think you want to do it, what are you trying to do?

It is pretty difficult to add a button to an inactive form with code and I thimk impossible to do to an active form.

It only takes three words to make a previously installed invisible button pop into view.



Ken, Slow? First reply took 12 minutes.

Kenneth Hobs
10-03-2013, 06:51 AM
When I say make a sample file, this means to manually markup the file as you like. It sounds like you are wanting to use a Userform to do that. Just create 1 or 2 userforms manually to show what you want. If you are using a worksheet as a form somehow, there again, manually markup two sheets to show before and after. It does not take long to do this sort of thing.

As Sam said, if you manually create the textbox controls in the Userform, you can make all but one "invisible" when you create them and then make the next one visible by a click of a CommandButton or such by code. The problem with this is that you will have a finite size for your Userform and therefore, a limited number of textbox controls.

SamT
10-03-2013, 07:21 AM
Re Form size: If you just want to show one new TextBox at a time, you can stack them at design time and set the ZOrder of the one you want on top at run time.

A better option might be to use a MultiPage Control to organize the Input controls. See: Excel Menu >> Tools >> Options for an example of a MultiPage.