9.4. VBA system

Lecture



The VBA system is a subset of the VB and includes the means of building VB applications, its data structures and control structures, which make it possible to create custom data types. Like VB, VBA is an event-driven visual programming system. It has the ability to create forms with a standard set of controls and write procedures that handle the events that occur during certain actions of the system and the end user. It also allows the use of elements of ActiveX and automation. The VBA system is a complete programming system, but does not have the full range of capabilities that the latest version of VB has.

Programming in the VBA environment has a number of features. In particular, it is not possible to create a project in it independently of these applications.

Due to the fact that VBA is a visual system, the programmer is able to create the visible part of the application, which is the basis of the "program - user" interface. Thanks to this interface, the user interacts with the program. On the principles of the object-oriented approach, which is implemented in VBA in relation to applications running under Windows, a software interface is developed.

Characteristic of these applications is that on the screen at any time there are many objects (windows, buttons, menus, text and dialog boxes, scroll bars). Taking into account the algorithm of the program, the user has a certain freedom of choice regarding the use of these objects, that is, he can click on a button, transfer an object, enter data into a window, etc. When creating a program, the programmer should not limit the user's actions, he should develop a program that responds correctly to any user action, even an incorrect one.

For any object a number of possible events is determined . Some events are caused by user actions, for example, single or double-clicking, moving an object, pressing a keyboard key, etc. Some events occur as a result of other events: the window opens or closes, the control becomes active or loses activity.

Any of the events manifests itself in certain actions of the program, and the types of possible actions can be divided into two groups. The actions of the first group are a consequence of the properties of the object, which are established from some standard list of properties that are set by the VBA programming system and the Windows system itself, for example, minimizing the window after clicking the Minimize button. The second group of actions on events can only be determined by the programmer. For any event possible, the response is provided by creating a VBA procedure. It is theoretically possible to create a procedure for each event, but practically the programmer fills in the procedure code only for events of interest in this program.

VBA objects are functional, that is, they act in a certain way and are able to respond to specific situations. The appearance of the object and its behavior affect its properties, and the methods of the object determine the functions that the object is capable of performing.

Participating properties are properties that define nested objects.

Objects are able to respond to events - initiated by the user and generated by the system. Events triggered by the user appear, for example, when you press a key, by clicking the mouse buttons. Based on this, any user action can lead to a whole set of events. Events generated by the system occur automatically in the case provided by the computer software.


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Informatics

Terms: Informatics