Extra_Cover
Registered User.
- Local time
- Today, 19:54
- Joined
- Oct 21, 2008
- Messages
- 71
Hi
A client has recently upgraded from Office 2000 to Office 2010 and I am struggling to get an auto-mail routine to work that worked in 2000.
A scheduled task runs during the evening running the following code from an Access database.
The strange thing is that it looks likes the code works - the task is completed successfully but the e-mail is in the INBOX of the Outlook session...?
I have tried saving the db as 2003 & 2007 but nothing seems so solve the problem.
Any ideas appreciated as I have been trying to find a solution for several weeks now.
A client has recently upgraded from Office 2000 to Office 2010 and I am struggling to get an auto-mail routine to work that worked in 2000.
A scheduled task runs during the evening running the following code from an Access database.
Code:
Public Function MailStockOut()
Dim objOutlook As Outlook.Application
Dim oItem, SafeItem
Set objOutlook = CreateObject("Outlook.Application")
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = objOutlook.CreateItem(0) 'Create a new message
Dim strPath As String
Dim strReportName As String
'Mail Price Check Report.
strReportName = "RptStockOut2"
'Output report as PDF
strPath = CurrentProject.Path
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strPath & "\" & strReportName & ".pdf"
With SafeItem
.Item = oItem 'set Item property
.Recipients.Add "xxx@xxx.uk.com"
.Recipients.Add "xxx@xxx.uk.com"
.Recipients.ResolveAll
.Subject = "Stock Out Report."
.Body = "Please find attached Stock Out Report."
.Attachments.Add strPath & "\" & strReportName & ".pdf"
.Send
End With
Kill (strPath & "\" & strReportName & ".pdf")
Set objOutlook = Nothing
End Function
I have tried saving the db as 2003 & 2007 but nothing seems so solve the problem.
Any ideas appreciated as I have been trying to find a solution for several weeks now.