0
我有一個問題,我無法得到我的頭。從MsgBox捕獲輸入
我有一個窗體,我有MsgBox
告訴用戶,如果一些箱子丟失的信息,然後詢問他們是否要繼續。
當用戶按下Yes
時,用戶窗體的值將被傳送到表單中。但是,當用戶選擇否時,值仍然傳輸...
如何使MsgBox
關閉,當用戶選擇No
,沒有值傳遞?
我有一個問題,我無法得到我的頭。從MsgBox捕獲輸入
我有一個窗體,我有MsgBox
告訴用戶,如果一些箱子丟失的信息,然後詢問他們是否要繼續。
當用戶按下Yes
時,用戶窗體的值將被傳送到表單中。但是,當用戶選擇否時,值仍然傳輸...
如何使MsgBox
關閉,當用戶選擇No
,沒有值傳遞?
這是你想要的嗎?
Sub Sample()
Dim Ret As Variant
Ret = MsgBox("Blah Blah", vbQuestion + vbYesNo)
If Ret = vbYes Then
MsgBox "You pressed `Yes`" '<~~ Code to transfer to the sheet here
ElseIf Ret = vbNo Then
MsgBox "You pressed `No`"
End If
End Sub
如果你想記錄提交到紙張上,只有當用戶在窗口MSGBOX點擊「是」,你可以嘗試這樣的事情......
更換MSGBOX按你的需求。
Dim Ans As Long
Ans = MsgBox("You didn't fill all the information." & vbNewLine & vbNewLine & "Do you want to continue?", vbQuestion + vbYesNo, "Confirm Please!")
If Ans = vbYes Then
'Code to submit the records onto the Sheet
End If
你可以發佈你的代碼嗎? – avb
這裏是[用於MsgBox函數Microsoft文檔](https://msdn.microsoft.com/en-us/library/aa445082(V = vs.60)的.aspx)。 –