Access 2003 automation Outlook

C

Ceasarina

I´m trying to send messages with Outlook from Access 2003. This code works
just fine on Access 2000, but with 2003 it seems to work ONE TIME. Then I
have to restart the computer to make it work ONE TIME again...
Why? Would love to have some tips...
I have tried to add "outApp.quit" with the same result.

Function TestMail()

Dim outApp As Outlook.Application
Dim outMsg As MailItem
Dim Cancel As Boolean

Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
With outMsg
.To = "(e-mail address removed)"
.Subject = "Test av mailfunktion"
.Body = "Hej Peter!" & vbCrLf & "Jag testar och leker."
.Attachments.Add "C:\bilder\banner.jpg"
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top