我正在尝试为一个具有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发布于 2022-10-13 07:12:48
请用下一条路:
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 Subhttps://stackoverflow.com/questions/74051719
复制相似问题