VBA的消息框是或否MsgBox

调用一个消息框的选项是或否的答案,并根据不同的编码代码执行。

解释

为了调用一个消息框的选项是或否并根据不同的回答不同的执行方案时,分,是一种更良好的互动方式与最终用户

在VBA宏代码可供下载在本网页下场!

Public Sub MessageBoxYesOrNoMsgBox()

Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String

    QuestionToMessageBox = "Are you an expert of VBA?"

    YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "VBA Expert or Not")

    If YesOrNoAnswerToMessageBox = vbNo Then
         MsgBox "Learn more VBA!"
    Else
        MsgBox "Congratulations!"
    End If

End Sub

 

 

下载Excel文件!VBA_Message_Box_Yes_or_No_MsgBox.xls

 

Add your comment

Your name:
Subject:
Comment: