VBA - MsgBox InputBox. MsgBox , InputBox .
MsgBox() , , , Integer, , .
MsgBox:
MsgBox (Prompt [, Buttons] [, Title] [, HelpFile, Context])
:
Prompt , ;
Title , . , , VBA;
HelpFile , , ; , Windows Help Compiler. , Context;
Context , . , HelpFile;
Buttons , MsgBox. Buttons Windows . Buttons .
MsgBox:
Sub sample2()
MsgBox " ?", vbYesNo + vbInformation, ""
End Sub
MsgBox , (.. ). , . , , MsgBox , .. ( 2).
3. MsgBox
Sub sample3()
Dim res '
' MsgBox
res = MsgBox(" ?", vbYesNo + vbInformation, "") Debug.Print res '
End Sub
, Yes No res , .
MsgBox VBA. 7 MsgBox.
7 MsgBox
, | |
vbAbort | (Abort) |
vbCancel | (Cancel) |
vbIgnore | (Ignore) |
vbNo | (No) |
vbOk | |
vbRetry | (Retry) |
vbYes | (Yes) |
3 ( 4).
|
|
4. MsgBox
Sub sample4()
' MsgBox
res = MsgBox(" ?", vbYesNo + vbInformation, "")
' ,
If res = vbYes Then: MsgBox " Yes", " "
Else: MsgBox " No", " "
End If
End Sub
InputBox() , , , String, , . InputBox:
InputBox (Prompt [, Title] [, Default] [, XPos] [, Ypos] [, HelpFile, Context])
:
Prompt , ;
Title , . , ;
Default , , . , ;
Xpos Ypos , ; Xpos ; Ypos . , ;
HelpFile , , . , Context;
Context , . , HelpFile.
InputBox .
Sub sample5()
Dim username As String
username = InputBox(" ", " 5")
MsgBox (", "+username)
End Sub
(. 1).
1 VBA.
1.1 [4]: .
Sub lr1()
Const min_1h = 60
Dim min As Integer
Dim Hours As Single
min = Val(InputBox(" "))
Hours = min/min_1h
MsgBox min & " " & Hours & " (, )"
End Sub
. VBA. /.
:
1. .
- .
- .
- .
- .
- .
- . (1 =100 2).
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- (1 =100 2).
- .
- .
|
|