Here is an odd one. I have quite a few reports that have been running fine for years on an older WinXP PC (Office 2002). Since switching to a Win7 PC, all of the reports that are sent via SendObject (either in a macro or in a module) are being created correctly but get stuck in Outlook's outbox. I have to open Outlook (never needed to remain open on the XP PC) and manually click Send/Receive. This causes issues as most of the reports are scheduled to run before anyone is in the office. The odd part is this, when I use code to create the e-mail (not the docmd) it not only fires off the e-mail correctly but also sends all the items sitting in the outbox at that time. Here is the sample code:
If I run it as-is it works fine but as soon as I comment out everything in between the With and End With the e-mails get stuck.
I have checked through all of the settings in Outlook (2007) and even compared the settings to what is available in the old version of Outlook (2002) and cannot track down the issue.
Code:
Public Function test_module_send()
Dim dbs As Database, obEmail As Object, obMsg As Object, mynamespace As Outlook.NameSpace
Set dbs = CurrentDb
Set obEmail = CreateObject("Outlook.Application")
Set obMsg = obEmail.CreateItem(olMailItem)
DoCmd.SendObject acSendNoObject, , , "Email Address", , , "Testing SendObject", , no
With obMsg
.subject = "Test Module Send"
.To = "email address"
.Body = "Testing"
.Send
End With
Set obEmail = Nothing
Set obMsg = Nothing
Set obAttachment = Nothing
End Function
If I run it as-is it works fine but as soon as I comment out everything in between the With and End With the e-mails get stuck.
I have checked through all of the settings in Outlook (2007) and even compared the settings to what is available in the old version of Outlook (2002) and cannot track down the issue.