Solved using BODY in emails (1 Viewer)

kobiashi

Registered User.
Local time
Today, 12:08
Joined
May 11, 2018
Messages
258
hi all


i have a piece of VBA that converts a form into a PDF and emails it to a recipient, what i cant find or do , is change the layout in side the .Body of the email

Private Sub CmdPDF_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Dim fileName As String, todayDate As String

'Export report in same folder as db with date stamp
todayDate = Format(Date, "MMDDYYYY")
fileName = "C:\Users\stuar\OneDrive\Access\PDF\" & todayDate & ".pdf"
DoCmd.OutputTo acOutputForm, "FrmEventSRFRep", acFormatPDF, fileName, False


'Email the results of the report generated
Set oEmail = oApp.CreateItem(olMailItem)
With oEmail
.Recipients.Add "stuart.roberts@outlook.com"
.Subject = "SRF Form"
.Body = "Hi All, Please Find Attached the SRF Form"
.Attachments.Add fileName
.Send
End With

MsgBox "Email successfully sent!", vbInformation, "EMAIL STATUS"

DoCmd.Close acForm, "FrmEventSRFRep"

End Sub

How do i go to the next line for the email, so for example


Hi All,

please find attached info


Regards
 

Isaac

Lifelong Learner
Local time
Today, 05:08
Joined
Mar 14, 2017
Messages
8,738
You can go to the next line by doing something like:

.Body = "This is the first line" & vbnewline & "This is the second line"

Depending on precisely what type of formatting you're trying to do you might need to use .HTMLBody
 

kobiashi

Registered User.
Local time
Today, 12:08
Joined
May 11, 2018
Messages
258
thank you, thats worked a charm!!
 

Users who are viewing this thread

Top Bottom