.


:




:

































 

 

 

 


2. Visual Basic

2.1.

, . : , - , , . (, Word Selection Range). , , .

Office Visual Basic, . , , .

Visual Basic , .

! , Microsoft Office, VBA Visual Basic . COM- , , Visual Basic, C++, Delphi, Java, VBScript JavaScript, ActivePerl, C#, Visual Basic.NET . . VBA ( Visual Basic) Microsoft Office, Microsoft Office .

Visual Basic, . Office :

| Visual Basic;

Alt+F11;

Visual Basic ( );

;

.

, . 2.1.

. 2.1. Visual Basic Excel

! Visual Basic , . Alt+Tab ( "", Alt+F11).

Visual Basic 9 .

Project Explorer . Visual Basic. .

UserForm . , .

Toolbox . . .

Properties . .

Code . . .

Object Browser . , .

Watch . .

Locals . ;

Immediate . .

- : View , , .

, . Office Visual Basic . VBA Office .

2.2. (Project Explorer) VBA

Visual Basic . , :

Ctrl+R;

Project Explorer Standard;

View | Project Explorer.

Project Explorer VBA.

(Project), Word, Excel, PowerPoint , . , Visual Basic Word, Project Explorer Word Normal.dot. Visual Basic Excel, Project Explorer Excel PERSONAL.XLS.

, Office (, , . .), ( ) , . Insert Project Explorer.

VBA. :

( );

( ).

Word Normal.dot ( ) NewMacros ( Excel Module1), .

VBA , . :

( Project Explorer). VBA ( VB);

. , , ;

. , , , .

, . . VBA .

, , .

Project Explorer References, . . ( Excel ). , ( Word) , , , "" . Word Normal (. . Normal.dot), .

, .

Project Explorer . Project (VBAProject Excel) Project Properties ( Tools | Project Properties). :

. , ;

, , ;

, . , .

Project Explorer .

, , (, ) Insert | Module. .

( ), . Modules. , . , .

! , . , . , Normal ( Word) PERSONAL.XLS ( Excel).

(, , . .), Insert | UserForm. .

, ( ), VBA.

2.3. (Code Editor)

2.3.1.

, . :

Project Explorer ( Enter);

( Project Explorer, . .) View Code;

F7 ( View | Code).

, , , , , Ctrl , Word. - . .

2.3.2.

. . , . , General. , , .

. Declarations () , . , .

2.3.3.

, . , , , . . ( ) , . Edit ( ), Edit | Bookmark. , Toggle Bookmark.

, . . .

2.3.4.

, . .

. VBA- , . , , .

Visual Basic . : , , . . ( , , ), Tab. , Edit | List Properties/Methods Ctrl+J.

, Tools | Options ( Auto List Members Editor Options).

Visual Basic , , . : . , Edit | Parameter Info Ctrl+Shift+I. Auto Quick Info Editor Options.

( ) , '='. Edit | List Constants Ctrl+Shift+J.

VBA . Edit | Complete Word Ctrl+. , - .

, :

, . Auto Indent Options;

, ;

. Edit Comment Block Uncomment Block;

Sub Function, End Sub End Function. -;

, . , Auto Syntax Check Options. , ;

. Ctrl+Tab Ctrl+F6;

Full Module View . , Procedure View. .

2.4.

Office , .

Visual Basic F1. Standard. , . 2.2.

(, ) F1. , (, Range Range) .

Microsoft Office :

(Microsoft Excel Visual Basic Reference, Microsoft Word Visual Basic Reference . .) Office;

(Microsoft Visual Basic Documentation, Office) VBA;

(Microsoft Office Visual Basic Reference, Office) Office: , , Windows SharePoint Services . .

(, Microsoft Access) (. 2.3) ADO, SQL . .

. 2.2. VBA Excel . 2.3. VBA Access

, Office (. 2.4).

. 2.4. Excel

Programming Concepts ( ) , . , Excel , , . .;

Office: (Collections), (Objects), (Methods), (Properties) . . , ( , , Range Excel), . , .

, . . , , :

Programming Concepts ;

, , , . , Office . - Office, , , . , , ;

, . , , .

2.

:

1 , . :

( Selection.TypeText) :

Dim sInput As String

sInPut = InputBox(" ", " ")

:

Selection.TypeText Text:=(". . .")

( ) :

Selection.TypeText Text:=(". " & sInPut)

, , -.

, . , Visual Basic ( InputBox()) Word ( TypeText() Selection). .

2

1. Word Alt+F11. Microsoft Visual Basic Project Explorer, Normal | Modules | NewMacros, NewMacros F7. NewMacros.

2. Sub () . , , ( : , ):

Sub ()

'

'

' 02.05.2004 R

'

Dim sInPut As String

sInPut = InputBox(" ", _

" ")

Selection.TypeText Text:=" :" & vbTab & vbTab _

& vbTab & " . ."

Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

Selection.TypeParagraph

Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft

Selection.TypeText Text:=(". " & sInPut)

Selection.TypeParagraph

Selection.TypeText Text:=". 55-55"

End Sub

3. Ctrl+S, , Alt+Q, Word. , , .

 



<== | ==>
1. Microsoft Office | 3. VBA
:


: 2016-09-03; !; : 956 |


:

:

: , .
==> ...

1954 - | 1573 -


© 2015-2024 lektsii.org - -

: 0.084 .