Scheduled Task Doesn't work with Outlook 2007

  • Thread starter Thread starter CaptainBly
  • Start date Start date
C

CaptainBly

I have a small Access application that runs, initiates an instance of
Outlook, creates necessary emails, and exits. This is running on a
server as a scheduled task.

This worked fine with Outlook 2003. Client did a server upgrade and
upgraded to Outlook 2007. Now this task fails. If Outlook is open,
it runs fine but it fails if outlook is closed.

Is there a way to do this in Outlook 2007 without having Outlook open?

Any help is greatly appreciated.

Here is snippets of the code. It bombs on the recipients.add line.
If Outlook is open though, it runs without issue. Just not super
practical on a server with a scheduled task.



Set olookApp = New Outlook.Application
..
.. some other unrelated code here, setting up a while loop etc...
..

emailto = artsenddetail![emailaddress]

Set olookMsg = olookApp.CreateItem(olMailItem)

With olookMsg
Set olookRecipient = .Recipients.Add(emailto)

olookRecipient.Type = olTo

.Subject = "Art Verification - Project: " & artsend!
[BudgetNum] & " " & artsend![BudgetName]
.Body = control![ArtVerifyBody] & newline & newline &
standardclosing

If Not (IsNull(control![CompanyEmail])) Then
.ReplyRecipients.Add (control![CompanyEmail])
End If

Set olookAttach = olookMsg.Attachments.Add(filenamedest)
olookMsg.Send
End With
 
Further information... The error I get is 287 - Application-defined
or object-defined error
 
Back
Top