Write Sub Vba Displays Msgbox Message Ask Whether Total Receipt Sale Greater 100 Display Y Q37145943

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.