.


:




:

































 

 

 

 





, :

1. , . .

2. , . .

3. .

4. , . .

. TextBox () , . , .

( Name). , , .

Value. Variant. , TxtControl "abcdef": TxtControl.Value = "abcdef"

100: TxtControl.Text = 100

TextBox :

Dim varResult As Variant

varResult = txtControl.Value

. Label () . Caption, . Caption , :

labControl.Caption = ""

. CommandButton () . Caption , .

, Click .

. OptionButton () . . .

Value. True, , False - .

, . VBA.

, . , .

, :

- ;

- ;

- , , , .

VBA . :

- . . , , , . . , .

- / VBA.

. , . <F5>, \ / .

 

, . 10.2.

, :

1. VBA , .

2. . Name Caption " ".

10.2

 

3. (TextBox) . 5.3. : " txt1 ", " txt2 " " txtResult ". :

txt1 Value = 0

txt2 Value = 0

txtResult Value = 0

Enabled = False

4. (OptionButton). :

OptionButton1 Name =

Caption = " + "

Value = True

OptionButton2 Name =

Caption = " - "

OptionButton3 Name =

Caption = " / "

OptionButton4 Name =

Caption = " * "

5. (CommandButton) :

CommandButton Name =

Caption =

. Click . :

Private Sub _Click()

.Hide

End Sub

6. (CommandButton) :

CommandButton Name =

Caption =

, txtResult . , click :

 


Private Sub _Click()

Dim x As Variant

Dim y As Variant

Dim z As Variant

x = CDbl(txt1.Value)

y = CDbl(txt2.Value)

If .Value = True Then z = x + y

If .Value = True Then z = x - y

If .Value = True Then z = x * y

If .Value = True Then

If y = 0 Then

z = 0

MsgBox (" !!!")

Else

z = x / y

End If

End If

txtResult.Value = CStr(z)

End Sub


 

7. (Label), 10.2.

, . . , Excel, , , VBA. , Excel , .

:

1. ( /).

2. :

Sub RunForm()

.Show

End Sub

3. Microsoft Excel , .

4. , . , / /.

5. . . . . , , . RunForm .

6. .

, - , Excel.

1. Visual Basic?

2. ?

3. Visual Basic?

4. Visual Basic?

5. ?

6. ?

7. , ?

8. ?

9. ?

10. Visual Basic?

11. ?

12. Label, Caption, Command, Button, Form, design, run. .

13. , , ?

14. ?

15. ?





:


: 2016-11-12; !; : 796 |


:

:

, , 1:10
==> ...

1649 - | 1574 -


© 2015-2024 lektsii.org - -

: 0.014 .