我有一个宏设置来运行多个savedimportexports,但当一个失败时,我需要它发送一封电子邮件,其中saveimportexport的标题失败并继续下一个,所以我可以回去之后重新运行导出。我有电子邮件部分设置,我只需要知道如何将savedimportexport的标题放在电子邮件正文中。 Err.Description,Err.Number,Err.Source没有我需要的东西。以下是我的代码......
Function Payday_Audit_Biweekly()
On Error GoTo Payday_Audit_Biweekly_Err
DoCmd.RunSavedImportExport "Export 1"
DoCmd.RunSavedImportExport "Export 2"
DoCmd.RunSavedImportExport "Export 3"
DoCmd.RunSavedImportExport "Export 4"
DoCmd.RunSavedImportExport "Export 5"
DoCmd.RunSavedImportExport "Export 6"
Call file_copy
DoCmd.RunMacro "CloseDatabase", , ""
Payday_Audit_Biweekly_Exit:
Exit Function
Payday_Audit_Biweekly_Err:
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")Set oMail = oApp.CreateItem (olMailItem)
oMail.Body = 'This is where I need the title of the SavedImportExport'
oMail.Subject = "Report Failed"
oMail.To = "myemailaddress"
oMail.SendUsingAccount = oApp.Session.Accounts.Item(1)
oMail.Display
SendKeys "%s", True
Set oMail = Nothing
Set oApp = Nothing
Resume Next
End Function