ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 06.06.2021
Просмотров: 3232
Скачиваний: 5
591
,
.
:
Sub Proc_B (Val1 As Single; Val2 As Date;... )
(
Windows –
)
.
,
.
,
Optional.
19.18.
Sub SquarPr (L As Single; H As Single;
S As Single; Optional F)
If IsMissing (F) Then F=100
S=L*H
End Sub
SquarPr
VBA – IsMissing
F,
F
,
F
100 (F
Variant)
.
1-
–
Sub Proc_A ()
Dim Sq as Single
SquarPr 12; 23; Sq
End Sub
,
Sq
2-
–
,
Sub Proc_A ()
Dim Sq as Single
Dim LL as Single
Dim HH as Single
LL=12
HH=23
SquarPr LL HH Sq
End Sub
,
Sq
3-
–
592
Sub Proc_A ()
Dim Sq as Single
Dim LL as Single
Dim HH as Single
LL=12
HH=23
SquarPr L:=LL; H:=HH; S:=Sq
End Sub
,
:
,
.
:
Static <var> As <type>
,
(
).
.
.
,
.
By Val
,
.
19.19.
.
19.20.
Sub Proc_A ()
Dim Sq as Single
Dim LL as Single
Dim HH as Single
LL=12
HH=23
SquarPr L:=(LL); H:=(HH); S:=Sq
End Sub
VBA
VBA
,
.
,
,
,
.
,
VBA (
. 19.6)
(
).
VBA
,
Variant,
–
String.
593
(String),
:
;
;
.
VBA
,
– $.
,
$:
1 9 . 6 .
VBA
ABS() –
;
RND() –
;
INT() –
;
.
LCASE() –
;
UCASE() –
;
LEFT() –
;
RIGHT() –
;
LEN() –
.
DATE() –
;
CDATE() –
;
() –
;
NOW() –
(
);
DAY() –
;
MONTH() –
;
WEEKDAY() –
;
YEAR() –
.
IN () –
(
);
CSTR() –
;
CVAR() –
VARIANT;
FORMAT() –
,
,
,
;
STRCOMP() –
;
VAL() –
.
FILEATRR() –
;
FILEDATETIME() –
)
;
FILELEN() –
;
FREEFILE() –
.
VBA
,
,
,
(
);
.
:
594
!
–
As <type>.
.
19.21.
Sub Proc_A ()
Dim S as Single
Dim LL as Single
Dim HH as Single
LL=12
HH=23
S=Sq(LL;H)/2+1200
End Sub
Function Sq (H As Single; L As Single As Single)
Sq=H*L
End Function
Sq
Sq
Sq
VBA
,
:
,
,
.
If.
:
.
:
If <
> Then <
>
(
).
(True),
,
Then;
(False),
If
.
–
,
:
).
.
19.22.
If MaxPrice > 23,000.00$ Then MaxPrice=23,500.00$
If Student_Card(100).FullName Like "
*" Then number=Student_Card(100).Group
VBA.
:
595
Not
And
Or
" "
"
"
r
Imp
Eqv
"
"
.
1
,
1,
2
.
,
Else,
,
–
,
End If.
19.23.
If
If AvgPrice > 12000 Then
DiffPrice=Full(234, 45600)
1
1
,
ElseIf AvgPrice > 24000 Then
DiffPrice=Full( 12000, 45000)
ElseIf AvgPrice > 36000 Then
DiffPrice=Full(24000, 50000)
Else
DiffPrice=Full(36000, 70000)
End If
2
2
,
3
3
,
1 – 3
,
If
Select Case.
,
(
):
: Case 45
Case 3, 4, 5,
Case 5
12.
,
Else,
Else
,
,
End Case.
19.24.