Database Reference
In-Depth Information
Notice that the item “ThisWorkbook” is highlighted in the IDE Project window. That indicates that it is the
active window, and you can enter your VBA code into the workspace on the right. Once that code is
entered, you can click on the title of the subroutine and select Run>Run Macro option on the IDE toolbar.
You can also save the workbook, exit and re-open the workbook, or press the “F5” function key to make
the form execute. If the UserForm1 image does not appear, then check your security settings to ensure that
you have Excel macros enabled. Once the workbook opens, the form should appear on your screen and
look similar to Figure 14.14.
Figure 14.14: UserForm1 Is the Graphical User Interface Displayed While the Tool Is
Running.
This form looks great all by itself, but it still does not do anything. So, let's work on getting the data from
the worksheet to the form.
Link the data from worksheet “Common_Parm_Text” to the UserForm1 data fields
Select TextBox1 by clicking on the empty field next to the word “Year”, and then enter “Control_info!A2”
in the Properties window in the “ControlSource” field. The data in Cell A2 of worksheet “Control_info”
will become linked to the UserForm1 control called TextBox1, and will be visible. We'll do the same thing
with the other text boxes. See Figure 14.10 to find out what cell to assign to each text box.
Search WWH ::




Custom Search