vba 在 ms access 2010 中发送带有两个附件的电子邮件的按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14292313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
button to send email with two attachment in ms access 2010
提问by CrashOverride
I have a database in which i want to create a button which will send email with two attachments from outlook. Paths to Files can be given. and it should give a popup like the form you get when you create a new mail to check if the body in the mail is correct?
我有一个数据库,我想在其中创建一个按钮,该按钮将从 Outlook 发送带有两个附件的电子邮件。可以给出文件的路径。它应该提供一个弹出窗口,就像您在创建新邮件时获得的表单一样,以检查邮件中的正文是否正确?
Any idea how to achieve this?
知道如何实现这一目标吗?
Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "[email protected]"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
采纳答案by CrashOverride
Figured it out!!!! Thanks to ryadavilli
弄清楚了!!!!感谢 ryadavilli
Instead of .send it was .Display
而不是 .send 它是 .Display
and it worked
它起作用了