Insert blank line in vba email code

Asked

Viewed 99 times

-1

Good morning, I’m having a problem creating the vba code, I can insert an e-mail body line, put the second line, but when I trigger the email, what should be the second line is together with the first, follows code below:

Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

Set Corpo = Nothing
On Error Resume Next

Corpo = " Olá, segue dados do MTR Nº " & Textnummtr & " - " & Textdata & Chr(10)
Corpo = Corpo & " Item: " & cboitem & Chr(10)





Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
'Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "MTR"
.HTMLBody = Corpo
.Send 'or use .Display

End With

Set OutMail = Nothing
Set OutApp = Nothing

End Sub

1 answer

0

Use the command vbCrLf:

texto = "linha1" & vbCrLf & "linha2"
msgbox texto

Browser other questions tagged

You are not signed in. Login or sign up in order to post.