|
UserForms in VBA for ExcelDiscover the amazing world of userforms. The only limit is your imagination and like all of us experienced Excel VBA developers you will get carried away at times. Userforms are created to allow the users of your applications to supply information that you will store in a database or use as parameters within your VBA procedures. Userforms are fun to develop but they require a lot of investments (time and money). In other programming environments (databases, C++, COBOL....) developers are forced to use userforms because they don't have worksheets to play with. YOU ARE NOT. Never forget that you are working in Excel and a lot of things can be done on regular sheets saving you development time, costs and aggravations. But sometimes the userform is what looks attractive to your user, they are what makes the clients call you back.....unless it gets too expensive. Developing Userforms and Adding ControlsYou create a userform, you add controls and then you fine tune the design and fix the tab order. Userforms Properties and VBA CodeThen you set the properties including the important ones "On Activate" and "On Close" Excel VBA Controls' Properties and VBA CodeThey are the command buttons, the list boxes, the combo boxes, the text boxes...and they all have properties. Here they are. What must happen when you click on a command button, when you change the value in a combo box? Here is the code to tell Excel about it. Properties and VBA code for Command ButtonsThe "CLICK " control where most of the code resides in a userform Properties and VBA code for LabelsThe user just sees it and cannot submit any information with it. YOU are talking to the user Properties and VBA code for Text BoxesThe user is now talking to you. I have rarely seen a userform without text boxes. The format is the challenge. Properties and VBA code for Combo BoxesThe BIG control. It is a drop-Down list. Properties and VBA code for List BoxesWhen multiple choice is a necessity Properties and VBA code for Check Boxes, Option Buttons and FramesThe "True/False" controls to be used as a group with a frame Properties and VBA code for Spin ButtonsThey are sexier than text boxes and sometimes make a difference in the clients' opinion of your talent. |