Vba forms creation in Excel
In the previous chapter, we learned about Graphical User Interface basics.
GUI is nothing but a visual interface which displays various controls like buttons, textboxes and so on.
Form is nothing but a container that holds these controls.
GUI is not possible without forms.
In short, Form is the container for all controls that make up the user interface.
Forms are sometimes called as Windows.
The following figure shows a form in VBA.
As seen from the above, the form holds various controls like textbox,Labels.
Thus the form makes up the GUI.
A form has various events associated with it, some of which are as discussed below.
Initialize Event
This event is triggered whenever a form is opened for the first time.
The syntax for this event is as below:
Activate Event
This event is triggered whenever the form is activated are focussed.
This differs from Initialize event in the sense that, this event is triggered everytime the form becomes active, including the first time.
The syntax is as follows:
Click Event
This event is activated whenever the user form is clicked.
The syntax of this event is as shown below: