我在 MSAccess VBA 中有一个电子邮件 (SendObject) 例程。如果用户决定不提交点击发送按钮,代码会崩溃,并简单地关闭电子邮件表单。
Private Sub ButtonSupportEmail_Click()
Dim varName As Variant
Dim varCC As Variant
Dim varSubject As Variant
Dim varBody As Variant
varName = "somebody@gmail.com"
varCC = "somebody@gmail.com"
varSubject = "ADB Front End Client Support_" & Now()
varBody = "Dear Amazing ADB Support Team:"
DoCmd.SendObject , , , varName, varCC, , varSubject, varBody, True, False
End Sub
是否有错误捕获我可以添加提示(通过弹出表单)用户“未发送电子邮件”并正常关闭?