ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 06.06.2021
Просмотров: 3229
Скачиваний: 5
596
Select CDemse
Select,
,
– Demse
CaseDemse21
Dem=21
,
Case Demse 22; 25; 28
–
Dem=31
,
Case Demse 45 To 48
,
Cdemse
45
48
Dem=41
,
Case Else
Dem=51
End Case
Select
For-Next.
,
,
,
(
)
,
.:
,
Next.
(
),
(
)
.
,
,
Next.
Exit For.
,
Next
.
For-
Next
.
19.25.
597
Sub stickRandom()
Dim numrows As Integer; numcols As Integer
Dim therow As Integer; thecol As Integer
numrows = Selection.Rows.Count
numcols = Selection.Columns.Count
Debug. Print numrows; numcols
Randomize
Debug.Print Rnd For therow = 1 To numrows
For thecol = 1 To numcols
Selection. Cells(therow; thecol).Value = Rnd
Next thecol
Next therow
End Sub
Selection –
Cells –
Value –
"
"
Do-Loop.
,
Do
–
,
Loop
–
;
4
:
1)
True
Do While <
>
>
Exit Do
>
Loop
,
>.
– 0.
Exit Do
Loop
–
.
2)
True
Do
>
Exit Do
>
Loop While <
>
,
>.
3)
False
Do Until <
>
>
Exit Do
>
Loop
Until
,
,
>
.
– 0.
4)
False
Do
>
Exit Do
598
>
Loop Until <
>
,
,
.
– 1.
19.26.
Option Explicit
Sub Do_Rnd()
Dim a As Single
Dim i As Integer,
Randomize
Do While True
a=Rnd
Do.
–
Debug.Print a
If a > 0.99 Then Exit Do
Loop
End Sub
–
While-Wend.
Do While-Loop.
(Exit Do
),
.
While <
>
>
Wend
For Each.
,
.
(
)
.
,
.
–
.
For Each <
> In <
>
>
Exit For
>
<
>
Variant, <
> –
.
Exit For.
VBA
:
.
–
,
,
ANSI.
:
.
:
.
599
,
.
,
.
FileFree,
(
1-511).
:
Open <
> [For <
>] [Access <
>]
[<
>] As [#]
[L n=<
>]
<
> -
,
;
<
> -
:
Append
Binary
Input
Output
Random
;
> -
:
Read
Write
Read Write
;
> -
:
Shared
Lock Read
Lock Write
Lock Read Write
;
-
;
> -
,
– 32767
.
(512
).
;
.
Binary, Input, Random
,
;
Append, Output
.
19.27.
Open "FILE" For Input As #1
Open "FILE" For Binary Access
Write As #1
Type Record Define userdefined type
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record
Open "FILE" For Random As #1
Len = Len(MyRecord)
Open "FILE" For Output Shared As #1
Open "FILE" For Binary Access
Read Lock Read As #1
.
Len
(
)
,
600
:
Close [<
>]
,
.
19.28.
Close #1; #2; #4 '
,
1,2,4
Close '
.
1.
–
:
Print #
; [<
>]
:
[{Spc(n) | Tab[(n)]}] [<
>] [charpos]
Spc(n) -
;
Tab(n) -
;
<
> -
;
charpos -
.
;
(
).
,
Print.
19.29.
Open "FILE" For Output As #1
Print # 1 ; "
"
Print #1;
Print #1; "
"; Tab ; "
"
Print #1; "
" ; " " ; "
"
Print #l;Spc(5); "
"
Print #l;Tab(10); "
"
MyBool = False
MyDate = #February 12, 1969#
MyNull = Null
MyError = CVErr(32767)
Print #1; MyBool;
Print # 1; MyDate; "
"
#
1 ; MyNull; "
"
Print #1 ; My Error; "
"
Close #1
5
10