Write a sub in VBA that displays a MsgBox. The message shouldask whether the total receipt for a sale is greater than $100, andit should display Yes and No buttons. If the result of the MsgBoxis vbYes (the built-in VBA constant that results from clicking theYes button), a second message box should inform the user that shegets a 10% discount.
Solution
Private Sub discount_click()
Dim str As String;
str=MsgBox(“The total receipt for a sale is greater than$100…?”, MsgBoxStyle.YesNo, “Message”);
If str= vbYes Then
MsgBox(“You are eligible to get a 10% discount”)
Else
Msgbox(“You are not eligible to get 10% discount”)
End If
End Sub
Note: Syntax of Messagebox is,
MsgBox(
OR
OR