This procedure always worked fine in Access2003, but it does nt in Access2007.
Anyone can point out what is wrong? Or maybe has a working piece of code?
Private Sub Exportmail_Click()
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("email@example.com")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("")
'objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Export wedstrijd"
.Body = "Export van wedstrijd" & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
AttachmentPath = Application.CurrentProject.Path & "\Export.xls"
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Set objOutlook = Nothing
Would be nice if this also worked in 2003 version.. (the DB is used by several people using different versions..)