我正在嘗試為帶有 YES/NO 回應的 vba MsgBox 設定 IF 陳述句。可能嗎?這就是我所擁有的:
Sub EmailAttachments()
Dim Msg001 As String
Dim Msg002 As String
Msg001 = "Continue creating your email"
Msg002 = "Save your attachments prior to creating an email"
MsgBox "Have you saved your attachments", vbYesNo, "ATTENTION!"
If vb = Yes Then
MsgBox Msg001, vbOKOnly, "CONTINUE"
Else
MsgBox Msg002, vbOKOnly, "EMAIL NOT CREATED"
End if
End Sub
uj5u.com熱心網友回復:
請使用下一種方式:
Sub EmailAttachments()
Dim Msg001 As String, Msg002 As String, answer As VbMsgBoxResult
Msg001 = "Continue creating your email"
Msg002 = "Save your attachments prior to creating an email"
answer = MsgBox("Have you saved your attachments?", vbYesNo, "ATTENTION!")
If answer = vbYes Then
MsgBox Msg001, vbOKOnly, "CONTINUE"
Else
MsgBox Msg002, vbOKOnly, "EMAIL NOT CREATED"
End If
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/515453.html
上一篇:合并檔案夾VBA中的所有作業表
