我的VBA腳本中有一個Yes/No MsgBox
,它返回一個供用戶回答的問題。每當按下「是」或「否」按鈕時,除了運行其各自代碼的腳本之外,彈出另一個帶有數字「6」或「7」的MsgBox
。如何禁用第二個MsgBox
?MsgBox是/否Excel VBA
這裏是我的代碼:
Dim question As Integer
question = MsgBox("Unfortunately, the Database has no sources regarding " & Category & " in " & country & ". Would you like to broaden your search and see all sources regarding " & country & "?", vbYesNo + vbQuestion, "Empty Sheet")
MsgBox question
If question = vbYes Then
Sheets("Results").Range("D6").ClearContents
Sheets("Results").Range("D7").ClearContents
Category = Sheets("Results").Range("D6").Value
Else
Sheets("Results").Range("D5").ClearContents
Sheets("Results").Range("D6").ClearContents
Sheets("Results").Range("D7").ClearContents
Exit Sub
End If
好吧,你叫'MsgBox'兩次,不是嗎? – GSerg
對不起,你的意思是? – franciscofcosta
刪除'MsgBox question' – Limak