I have to create Outlook Task from Access. All works fine but I cannot figure out how to create a new line in Body. This is my code:
Public Function AddOlTask(sSubject As String, sBody As String, _
dtDueDate As Date, dtReminderDate As Date)
Const olTaskItem = 3
Dim OlApp As Object
Dim OlTask As Object
Set OlApp = CreateObject("Outlook.Application")
Set OlTask = OlApp.CreateItem(olTaskItem)
With OlTask
.Subject = sSubject
.DueDate = dtDueDate
.Status = 3
.Importance = 1
.ReminderSet = True
.ReminderTime = dtReminderDate
.categories = "Business"
.Body = sBody
.Save
End With
End Function
I tried to use <br/>
, vbCrLf
. I tried to assign it similar to Message to property like .HTMLBody = sBody
(incorrect property). Used .RTFBody = -1
. Nothing works. Any suggestion?
I got it. The string has to be written like this:
It creates this message:
SuborderID: 62075 PO Date: 3/12/2020