You get a bonus - 1 coin for daily activity. Now you have 1 coin

9.5. VBA programming language

Lecture



VBA programming language is designed for writing program code. It has its own alphabet, which includes:

lowercase and lowercase letters of the Latin alphabet (A, B ...., Z, a, b ...., z);

lowercase and uppercase Cyrillic letters (A — Z, a — Z);

non-displayable characters used to separate the tokens (lexical units) from each other;

special characters involved in building language constructs: + - *? ^ => <[] (): {} '& ©;

numbers from 0 to 9;

underscore “_”;

compound characters perceived as one character: <=,> =, <>.

A lexeme is a unit of program text that has a specific meaning for the compiler and cannot be broken further.

The VBA program code is a sequence of tokens, written in accordance with the accepted syntax rules, which implements the desired semantic construction.

An identifier is a sequence of letters, numbers, and underscores.

The VBA system defines some restrictions that apply to the names:

1) the name should start with a letter;

2) the name must not include periods, spaces, separators, operation signs, special characters;

3) the name must be unique and not coincide with the reserved words of VBA or other names;

4) the length of the name should not exceed 255 characters;

5) when drafting names, it is necessary to observe style agreements;

6) the identifier should clearly reflect the purpose of the variable to understand the program;

7) it is better to use lower case letters in names; if names include several names, they should be separated from each other by underscore or a new word should be written with a capital letter;

8) the names of the constants should be made up of capital letters;

9) the name of the identifier must begin with a special sign indicating the type of data associated with this identifier.

Variables are objects that are intended to store data. Before using variables in the program, you must declare them (declare). Choosing the right type of variable ensures efficient use of computer memory.

String variables can be variable and fixed length.

Objects whose values ​​do not change and cannot be changed during program execution are called constants. They are divided into named and unnamed.

Lists are used to declare a group of constants united by a common name; moreover, they can only be declared in the global declaration section of a module or form.

Variables are divided into two types - simple and variables of the structural type. Arrays are one-dimensional and multi-dimensional.

After the declaration, the value of the variable may be arbitrary. An assignment operation is used to assign a variable to the desired value .

Mathematical operations are used to write a formula, which is a program operator that contains numbers, variables, operators, and keywords.

Relationship operations can lead to the appearance of a value, and there are only two resulting values: true and false.

Logical operations are used in logical expressions; this happens when there are several selection conditions in relational operations.

Operations for working with strings are concatenation operations that allow you to combine the values ​​of two or more string variables or string constants. The result of such an operation is a longer string composed of source strings.


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