Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email excel attachment using Access 2003

Status
Not open for further replies.

splats

Technical User
Jan 2, 2003
131
Hello

myh code works great with access 2000 however when it is in 2003, it does not work. Any suggestions would be greatly appreciated.

Thank you

Private Sub cmdEmailEmplSum_Click()
On Error GoTo Err_cmdEmailEmplSum_Click

Dim stDocName As String, emailTo As String, emailCC As String, emailBCC As String

stDocName = "Employee Summary of Incidents All"
emailTo = ""
emailCC = ""
emailBCC = ""

Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook

'MsgBox ("In the next screen, please choose attachment format. Snapshot Format is highly recommended in order to keep formatting of the document.")

DoCmd.SendObject acReport, stDocName, acFormatXLS, emailTo, emailCC, emailBCC, "Safety Database Employee Summary of Incidents All Report", "As attached."
'DoCmd SendObject [ObjectType As AcSendObjectType = acSendNoObject], [ObjectName], [OutputFormat], [To], [Cc], [Bcc], [Subject], [MessageText], [EditMessage]
End With

Exit_cmdEmailEmplSum_Click:
Exit Sub

Err_cmdEmailEmplSum_Click:
MsgBox Err.Description
Resume Exit_cmdEmailEmplSum_Click
End Sub
 
Hi,

You are mixing two different methods of sending email. You are trying(!) to use object appOutLook , but you don't need it for docmd.sendobject.
To solve your problem, I would suggest that you take a look a: this thread

Also, I would suggest to use "Option Explicit" in your code (insert it at the top of the module).

EasyIT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top