我有一个数据库,我想在其中创建一个按钮,该按钮将发送带有两个附件的电子邮件 从展望。可以给出文件路径。它应该提供一个弹出窗口,就像你在创建一个新邮件时检查邮件中的正文是否正确一样?
知道如何实现这个目标吗?
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 = "info@datastrat.com"
.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
答案 0 :(得分:0)
想出来!!!!感谢ryadavilli
而不是.send是.Display
并且有效