Below is the code I am currently using to send email from
Access. I would like to attach a query as an excel file but
do not know how to using this code. Can anyone offer suggestions
as to how to accomplish this with the below code?
Access. I would like to attach a query as an excel file but
do not know how to using this code. Can anyone offer suggestions
as to how to accomplish this with the below code?
Code:
Private Sub StatsNewPartsQryFrm_Click()
Dim O As Outlook.Application
Dim m As Outlook.MailItem
Dim toEmail1 As String
Dim toEmail2 As String
Dim ccEmail1 As String
Dim ccEmail2 As String
Dim ccEmail3 As String
Dim bccEmail1 As String
Dim SL As String, DL As String
SL = vbNewLine
DL = SL & SL
Set O = CreateObject("Outlook.Application")
Set m = Outlook.CreateItem(0)
'toEmail1 = DLookup("ActualName", "ChangeFormUserNameTbl", "LoginName='" & GetCurrentUserName() & "'")
ccEmail1 = ""
ccEmail2 = ""
ccEmail3 = ""
bccEmail1 = ""
m.To = "aldeb@chpl.net"
m.CC = ""
m.BCC = ""
m.Subject = "New Part Query."
m.Body = "Please see attached Excel File for New Part Qry by Date Range." & DL & _
DLookup("ActualName", "ChangeFormUserNameTbl", "LoginName='" & GetCurrentUserName() & "'")
m.Display
End Sub