The MsgBox Function
Sub msgboxdemo()
Dim ans As Integer
ans = MsgBox("continue ?", vbYesNo)
Select Case ans
Case vbYes
MsgBox "you clicked yes"
Case vbNo
MsgBox "you clicked no"
End Select
End Sub
Sub GetAnswer2()
If MsgBox("continue ?", vbYesNo) = vbYes Then
MsgBox "you clicked yes"
Else
MsgBox "you clicked no"
End If
End Sub
Sub GetAnswer3()
If MsgBox("continue ?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then
MsgBox "you clicked yes"
Else
MsgBox "you clicked no"
End If
End Sub
Sub GetAnswer3()
ans = MsgBox("continue ?", vbQuestion + vbYesNo + vbDefaultButton1)
If ans = vbYes Then MsgBox "you clicked yes"
End Sub
Sub Getanswer()
Dim msg As String, title As String
Dim config As Integer, ans As Integer
msg = "do you want to process the monthly report ?"
msg = msg & vbNewLine & vbNewLine
msg = msg & "processing the monthly report will"
msg = msg & "take approxmately 15 minutes. it"
msg = msg & "will generate a 30-page report for"
msg = msg & "all sales offices for the current"
msg = msg & "month" & Month(Now())
title = "Monthly Report"
config = vbYesNo + vbQuestion
ans = MsgBox(msg, config, title)
If ans = vbYes Then MsgBox "Run Report"
End Sub
No comments:
Post a Comment