james_halliwell
Registered User.
- Local time
- Today, 10:01
- Joined
- Feb 13, 2009
- Messages
- 211
Hi, need some help, i have created some code to get the records of a query and it puts them in the body of the emaiil but it doesnt format it well for examlpe the email looks like
James | halliwell | 31
Leanne | smith |27
Alexis | smith |8
i would like it to be in a table is this possible,
any help would be greatly appreciated
James | halliwell | 31
Leanne | smith |27
Alexis | smith |8
i would like it to be in a table is this possible,
Code:
Public Function SendEmail()
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset("QryUKBackOrderSummary", dbOpenForwardOnly)
With rst
Do While Not .EOF
Mailbody = Mailbody & ![ProductType] & " | " & ![ProductCode] & " | " & ![Description] & vbCrLf
.MoveNext
Loop
End With
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim strPath As String
Dim strFileName As String
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = "[EMAIL="JHalliwe@myemail.com"]JHalliwe@myemail.com[/EMAIL]"
'.CC = ""
'.bcc = ""
.Subject = "BackOrder Report" & Date
.Body = "UK Backorder Report " & vbCrLf & " " & vbCrLf & Mailbody
.Send
End With
rst.Close
Set rst = Nothing
MsgBox "done"
any help would be greatly appreciated