OPI_RGZ_2011
.pdf21
1.3.2K VBA -
«(», « », « », « » , o .
1.3.2.1 MS Word.
1.3.2.2( VBA (8 7 Visual
Basic).
1.3.2.3', o 9 ' -
.
1.3.2.4: : 9 Insert Userform, “.9” “Toolbox”.
1.3.2.58 5
“Commandbutton” (‡, +, -, :, :ˆ), “Label” (' -
, : , .), ( “TextBox” ( . 1.4). 9'n . 1.4.
7 1.4 – s 1.3.2
22
1.3.2.6“‡”, o 9 -
. ' n Private Sub -
n nK End Sub ( ). ( -
d :
Label3.Caption = Str(CInt(TextBox1.Text) * CInt(TextBox2.Text))
n ( , o
n TextBox1 TextBox2.
A ( (
, o ( Text 9’n TextBox1 TextBox2) n
K CInt.
. ( n , Caption 9’n Label3 n 9 , n -
K Str.
1.3.2.70 “+”, “–”, “:” “:”
9 :
Label3.Caption = Str(CInt(TextBox1.Text) + CInt(TextBox2.Text)) Label3.Caption = Str(CInt(TextBox1.Text) - CInt(TextBox2.Text)) Label3.Caption = Str(CInt(TextBox1.Text) / CInt(TextBox2.Text)) UserForm1.Hide.
1.3.2.8' K
“Run Run Sub/Userform” (“: | : /
”). 6 ( ( K
K 9 ( d d F5.
1.3.2.9: Word “.9-
”, A1 “.9”.
1.3.2.10: “' s ” K
K .
1.3.2.11: d , d “:” .
1.3.2.12: “.9”,
“: ” .
1.3.2.13d : Userform1.Show.
1.3.2.149 ( K 9.
1.3.3 ' 9 ,
(0e.y.:.J), -
23
d Arial 14 -
9 ( . 1.5).
7 1.5 – : 1.3.3
1.3.3.15 9 MS Word.
1.3.3.28 9 .
1.3.3.3' “J 9”. A
“8”. '
“Properties”. : 9 “Caption” - 9 .
1.3.3.4A 9 , o 9
( 9 o d. A 9'n -
-( K 9 “2 9Œ-
”. ' “2 • ”. 5
“' (” 9 “' ”.
24
1.3.3.5: 9 -( K 9'n -
“Ž ˆ ” 9 . : n-
( .
1.3.3.6, o , :
a)k – 9 ;
b)Text – -
9;
c)ZAGOLOVOK – , o n 9
.
d)REZULTAT – 9 ( 9,
9 9.
1.3.3.7: 9 K Count
9'n Paragraphs.
1.3.3.88 .
1.3.3.9: 9 9 -
.
1.3.3.10: - 9.
1.3.3.118 9
“0e.y.:.J”.
1.3.3.12: “0e.y.:.J”.
1.3.3.13d .
1.3.3.14: 9 , o 9 -
9 .
6 9 9. 8.4.
6 9 1.4 – 6 1.3.3
)( #-, |
N /# ,- |
|
|
Public Sub CommandButton1_Click() |
' |
|
|
Dim k As Integer |
1.3.3.6 a |
|
|
Dim Text As String |
1.3.3.6 b |
|
|
Dim ZAGOLOVOK As Range |
1.3.3.6 c |
|
|
Dim REZULTAT As Range |
1.3.3.6 d |
|
|
k = ActiveDocument.Paragraphs.Count |
1.3.3.7 |
|
|
|
|
|
25 |
|
|
|
' ( 9. 1.4 |
|
|
||
|
|
|
|
||
|
)( #-, |
|
N /# ,- |
||
Text = "J 9 - |
1.3.3.8 |
||||
- " & k & "." |
|
|
|||
|
|
|
|||
ActiveDocument.Paragraphs(k).Range.Inser |
1.3.3.9 |
||||
tParagraphAfter |
|
|
|||
|
|
|
|||
ActiveDocument.Paragraphs(k + |
1.3.3.10 |
||||
1).Range.InsertBefore Text |
|
||||
|
|
||||
Set |
REZULTAT |
= |
ActiveDocu- |
|
|
ment.Paragraphs(k + 1).Range |
|
9 |
|||
With REZULTAT |
|
|
|||
|
|
: |
|||
.Font.Name = "Arial" |
|
|
|||
|
|
– d – Arial |
|||
.Font.Size = 14 |
|
|
|||
|
|
– d – 14 ; |
|||
.Font.ColorIndex = wdDarkRed |
|
||||
|
– – |
||||
End With |
|
|
|||
|
|
|
|||
Set ZAGOLOVOK = |
|
|
1.3.3.11 |
||
ActiveDocument.Range(Start:=0, End:=0) |
|||||
|
|||||
With ZAGOLOVOK |
|
|
' With |
||
|
|
|
|||
.InsertBefore "0e.y.:.J" |
|
1.3.3.12 |
|||
|
|
|
|
||
.Font.Name = "Arial" |
|
|
1.3.3.13 |
||
|
|
|
|
||
.Font.Size = 24 |
|
|
1.3.3.13 |
||
|
|
|
|
||
.InsertParagraphAfter |
|
|
1.3.3.14 |
||
|
|
|
|
||
End With |
|
|
J With |
||
|
|
|
|
||
End Sub |
|
|
J |
||
|
|
|
|
|
1.3.4 K VBA ,
.1.3.4.1–1.3.4.10, d .
1.3.4.1 8 ,
Label ( ), CommandButton ( ). ' -
“ ” . v 9 ( Label ( ). 6 (
9 ,
. J
, . ' K “:-
26
” 9 . A
MS Excel 9 MS Word 9 -
“2 VBA”.
1.3.4.2: K MsgBox InputBox -
, o , o
. A MS Word 9 MS Excel
n .
1.3.4.3: K -
( , / ) -
, 9 o , o -
. A MS Word 9
MS Excel 9 .
1.3.4.48 MS Word 9 MS Excel
, K ( , ,
( ( . .) , K . 7 ( . . 8.6).
7 1.6 – : 1.3.4.4
27
1.3.4.55 y1 MS Excel 01–020
(–50; 50).
5 VBA (
, ,
.
A ( MS Excel. : ( K 9'n Application: Application.2 9(0).
1.3.4.65 , o 9
MS Word 9 Kn 9 « » -
(9 9, 9 ) -
9.
1.3.4.75 , o MS Word 9 Kn
-
9 .
1.3.4.85 , o MS Word
Kn
d : d – Arial, – 20 , (, –
.
6 ( 9 K
9, o 9 d .
1.3.4.95 , o MS Word
9 9 d K K , Kn d
9 -
9
.
A ( 9 9 Kn ( -
),
9 n 9 9 d K K .
1.3.4.105 , o MS Word
- n ( -
( , o d
, : •0y0•, 50e05, 0A0 .). 1.3.5 . 9.
1.3.6 : .
28
1.4 -% !%
1.4.16 9.
1.4.29.
1.4.3J .
1.4.46 9 9.
1.4.57 9.
1.4.6:, o
(5 d. 9 ), ( 9 ( K -
9 .
1.5 /b % , )
1.5.1” Visual Basic for Application?
1.5.2' Visual Basic for Application.
1.5.3u Visual Basic Ms Word?
1.5.4u d ?
1.5.5u : n?
1.5.6. d .
1.5.7u «K»?
1.5.8u 9 , o 9 -
?
1.5.9u ?
1.5.10u ?
1.5.11u K VBA?
1.5.12u K K VBA?
1.5.13~ K 9 VBA
Word?
1.5.14u VBA 9 Word?
1.5.15u ?
1.5.16u K VBA?
1.5.17u 9 ?
1.5.18u d d K -
9 VBA?
1.5.19' K VBA. '
K d .
1.5.20VBA?
29
2 OM-P Q R * 2
o P M M #
2.1 ' F ,
9 9 -
K 8#.
2.2 ! % ' ' ,& % !%(-%
s – , o 9 K n- K ( K. 8 Visual Studio.NET n
, ( -
.
e K. € d K -
: 9 n -
, d – d . 0 9-
9 K, o 9
( d . s MainMenu, ContextMenu K 9 K -
K. ' 9 -
9 .
A . : K – -
, 9 (, , , – n -
. 7 9. NET
:
OpenFileDialog, SaveFile Dialog, ColorDialog, PrintDialog (
.
s Button, LinkLabel, ToolBar K -
d K 9- K. 5 9 d d .
€d K (
, K , K
. s TextBox, RichTextBox K ,
Label, StatusBar . A 9 9 -
, , 9
9'n.
30
e . A (
9 ; n
K ( 9 . v 9 d -
, ComboBox, ListBox, ListView, TreeView, NumericUpDown 9 d.
e . n 5 -
'K, K -
d , -
. u , n , d ,
( K , , –
K . s Panel, GroupBox, TabControl,
d, K ( , 9 K 9.
e . 5
Windows - , , 9 9 (.A
o 9 ( K
9 K – Image List, Picture Box.
2.2.1 ! ' ) # / ! # -' 8
€d Windows- o K,
n 9 K n -
. ' , ( K -
, K K. A K n
MainMenu, d ToolBox. 8
NotepadCSharp. : -
. ' K
9. 8.1.
6 9 2.1 – 8 K
Form1, $ - , |
&' ) |
|
!/ ,!% b |
||
|
||
Name |
frmmain |
|
Icon |
Code\Glava2\NotepadCSharp\Icon\README.ICO |
|
|
||
Text |
Notepad C# |
|
WindowState |
Maximized |