小编Sta*_*acy的帖子

Access发送电子邮件,其中包含报告作为附件

在MS Access中使用VBA代码构建器,我已经能够编写打开Outlook的代码,并通过单击按钮向我发送电子邮件.我在添加附件时遇到问题.我发现的大多数代码都将MS数据库外的文件添加为附件,我想在我的数据库中添加一个作为附件创建的报告.

Private Sub EmailReport_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem

'Email the results of the report generated
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = "myemailaddress@email.com"
oEmail.Subject = "Training Roster"
oEmail.Body = "Roster Information"

With oEmail
    .Send
    MsgBox "Email Sent"
End With
Run Code Online (Sandbox Code Playgroud)

我一直在寻找类似的命令

oEmail.Attachments.Add Me.
Run Code Online (Sandbox Code Playgroud)

..但是,我找不到添加报告的正确组合.谢谢!!

email ms-access vba attachment report

3
推荐指数
1
解决办法
4万
查看次数

标签 统计

attachment ×1

email ×1

ms-access ×1

report ×1

vba ×1