03-02- .docm - 3.7.
, Properties. ? .
. Click cmd_First , , lbl_First.
Caption. , .
Caption , :
lbl_First.Caption = ""lbl_First. . , , .
.11.
, . Enter. , , , (, , Enter) .
, lbl_First. Caption , = , - , Caption.
.12.
lbl_First. Caption = " "
, .
, . , , , Caption lbl_First, . , cmd_Second Click :
MsgBox (lbl_First.Caption), "" . : " , Caption lbl_First ". , : " , lbl_First ". , .
. 13.
, . , Caption. , lbl_First :
lbl_First.Caption = " " lbl_First = " "
VBA - . , , .
|
|
.
1. VBA-?
2. VBA-?
3. ?
4. Properties - ?
5.
6. VBA?
File | ||
Window | ||
Element | ү | |
Editor | ||
List | ҳ | |
Document | Құ | |
Options | ||
Program | ғ |
1. HTML?
- , <table>
- , <draw table>
- , HTML
- , MS Word
2. <H1 Align=center> ?
3. VBA, Office?
- Office
- ,
- VBA C
- VBA
4. VBA shorthand PRINT?
- (?)
- P
- (!)
5. , :
- Single
- Long
- Integer
- Double
6. MySalary(IF Revenue>=1000000 THEN MySalary=500000 ELSE MySalary=Poor me! END IF), :
- Variant
- Currency
- Single
- Double
7. My_Passing_Grade(IF Final_Grade>=71 THEN My_Passing_Grade =TRUE ELSE My_Passing_Grade = FALSE END IF). :
- Function My_Passing_Grade(Final_Grade as Single) as Boolean
- Function My_Passing_Grade(Final_Grade as Integer) as Boolean
- Function My_Passing_Grade(Final_Grade as Integer) as String
- Function My_Passing_Grade(Final_Grade as Single) as String
8. String MyActor =Johnny Depp. String lower case (small letters)?
- LCase(MyActor) and LCase(Johnny Depp)
- LCase(Johnny Depp)
- LCase(Johnny)
- LCase(My Depp)
VBA-
.
1. . . , ., , 2008.
2 Internet : http://www.intuit.ru/studies/courses/3735/977/info
3 17-18 VBA: , , , , , , . | 4-, 3 5,7 2018-2019 . |
- .
- . ( - ), , .
|
|
VBA , . , . , [statements] " " , , .
, , " | ". , : " one | two " " one two".
. - VBA.
.
05-01-.docm - . 5.2.
, , . - . , , . - .
. - . , . - , . , . , ( ) ( ).
, . , .
, .
255
(#, $, % ..) .
VBA ( if, dim, for ..).
. Office.
, : str_Name, num_Age, str_Name1, num_Item2 .. , . . , .
VBA, . : " ", .
Microsoft Word cmd_Variables " ". Click ( 5.1.):
txt_Name = InputBox(" ") MsgBox (txt_Name)5.1. Click cmd_Variables
InputBox. . , - , .
. 1. .
. 1.
txt_Name = , txt_Name , , : " txt_Name , ". OK txt_Name. "", .
|
|
. - , MsgBox. - MsgBox, . , .
. 2.
, . (txt_Name), .
VBA
. , :
(, , );
, ( );
, (, "" );
, - . VBA .
. 1. VBA.
1. VBA | |||
, | |||
Variant | 16 () 22+ () | ||
Integer | 2 | -32768 32767 | |
Long | 4 | -2147483648 2147483647 | |
Single | 4 | : -3.402823E38 -1.401298E-45 : 1.401298E-45 3.402823E38 | |
Double | 8 | , | -1.79769313486231E308 -4.94065645841247E-324 : 4.94065645841247E-324 1.79769313486232E308 |
Byte | 1 | 0 255 | |
Currency | 8 | -922,337,203,685,477.5808 922,337,203,685,477.5807 | |
Decimal | 14 | 29- 28 | |
Boolean | 2 | True False | |
Date | 8 | 1 100 . 31 9999 . | |
Object | 4 | ||
String |
, VBA . , , . , Variant. , Variant . - .
, - , . , - .
, Double. , , - Integer Long. String. , , . Variant . , .
|
|
- Variant. , , , , ( ). - - , - , , . , , , ( - ), , ( , - ..) Variant.
. . . . 5.2. .
2. | |
s, str | |
n, num | ( , , , int Integer, dbl Double ..) |
b, bool | |
O, obj |
. - . . 5.2. Variant. .
: . - 5 10 - , , . :
a = InputBox(" ")., 20 ? 50, 1000 ?
. ? : .
- . .
5 : , , , .
- .
- , - . . , .
:
o 0. 0, - 1 ..
o , To.
o , 1, ( , ) OptionBase 1.
- , . , - Variant. , .
. . 2. .
2. | |
For - Next | . |
While - Wend | . , , |
Do - Loop | . . |
For - Next
07-02- For-Next.docm - . 7.4.
: 1 10 . , 10 : MsgBox ("1"). For - Next . 7.2. .
|
|
7.2. 1 10
For . i, . For - Next i 1 10.
. i - . To. i - .
Next , , .
- . , For - Next.
, 1. Step. 7.3. For - Next, 1 10.
For i = 1 To 10 Step 2 MsgBox (i) Next i7.3. 1 10
Step , . Step , . , : For i=10 to 1 Step -1. 10, - 9 .. - 1.
. , 10 , , .
7.4.
Dim MyArray(9) For i = 0 To 9 MyArray(i) = InputBox(" " & i + 1) Next i For i = 0 To 9 ' MsgBox (" " & (i + 1) & " " & MyArray(i)) Next i '7.4. 10
For-Next, . - .
1 | 2 | |
1 | 898989898 | |
2 | 343434343 | |
3 | 565656565 | |
4 | 121111212 | |
5 | 545454544 |
, . , 5 , .
. , 100100 . , Microsoft Excel . , , .
For-Next
07-04- .docm - . 7.6.
. - . , 1010 1 10 ( 7.6.)
Dim MyArray(1 To 10, 1 To 10) For i = 1 To 10 For j = 1 To 10 MyArray(i, j) = Int(Rnd(1) * 10) Next j Next i7.6. 1010
(i) , (j) - . - ( 1,1 1,10) ..