Text over two lines in VBA for email

Hi,

I have some code that is creating a lotus notes email. i want the text in body of the email to split over two lines

"Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._"
 & "If you have any questions around the content of this report, please contact your regional SPM team in the first instance.

I cant get the syntax right! Can someone amend please?!

Thanks
Seamus2626Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
At the end of the first line, try one of the following
 
& chr(13)
& chr(10)
& chr(13) & chr(10)
0
Seamus2626Author Commented:
"Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report" & Chr(13)
"If you have any questions around the content of this report, please contact your regional SPM team in the first instance."


"If you have any questions around the content of this report, please contact your regional SPM team in the first instance."

This is highlighted red now?

Thanks Phillip
0
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
You are missing an & after "& chr(13)". You had that at the start of line 2 in your example.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Seamus2626Author Commented:
MailDoc.Body = _
"Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" &
  & "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

That is still coming up red Phillip
0
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
And a _

MailDoc.Body = _
"Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" & _
  & "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"
0
FarWestCommented:
if you have a keyed enter while writing the lines (so your code is having two line numbers in editor)  then you have to use underscore at the end of first line _
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seamus2626Author Commented:
MailDoc.Body = _
 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" & _
   & "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"


That is returning all red Phillip
0
FarWestCommented:
please use code tag in comment editor and  post the code again
0
Seamus2626Author Commented:
Thanks

MailDoc.Body = _
 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" & _
   & "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

Open in new window

0
FarWestCommented:
there is 2 & at the end of third line and at the forth line , remove one of them
0
FarWestCommented:
remove &  in third line
0
FarWestCommented:
MailDoc.Body = _
 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" & _
    "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

Open in new window

0
Thomas Zucker-ScharffSolution GuideCommented:
why not use .HTMLBody instead?

For x = CInt(StartRow) To CInt(EndRow)
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .To = Worksheets(Name).Cells(x, 1) 'Row x, Column A
    .CC = ""
    .BCC = ""
    .Subject = Worksheets(Name).Cells(x, 3) 'Row x, Column C
    ' greeting using nickname
    .HTMLBody = "Dear " & Worksheets(Name).Cells(x, 18) & "," 'Row x, Column R
    ' first paragraph of letter
    .HTMLBody = .HTMLBody & Worksheets(Name).Cells(x, 8).Value 'Row x, Column H
    ' attach the previous years survey or a blank
    .Attachments.Add Worksheets(Name).Cells(x, 2).Value 'Row x, Column B
    ' attach this years facility usage table or a blank
    .Attachments.Add Worksheets(Name).Cells(x, 17).Value 'Row x, Column Q
    .display
    Application.Wait (Now + TimeValue("0:00:02"))
    Application.SendKeys "%s"
    '.Send
    End With
    Set OutMail = Nothing
Next x

Open in new window


Granted this is code to generate an outlook email, but it can be easily modified.
0
Sjef BosmanGroupware ConsultantCommented:
What HTMLBody? In a Notes mail? No can do.
0
Sjef BosmanGroupware ConsultantCommented:
You can use NotesMimeEntity objects, but then it's a completely different ballgame...
0
Thomas Zucker-ScharffSolution GuideCommented:
Didn't know that Notes mail didn't use .HTMLBody.  Time to switch to outlook :-)
0
FarWestCommented:
for me I don't know Lotus Notes at all :)
but very strange that it has VBA!, I thought IBM will never think to do that
0
Sjef BosmanGroupware ConsultantCommented:
Nope, notes has LotusScript, which is similar to VB. In this case, the application is an Excel application that communicates with the Notes client via the COM interface.

@FarWest: time to learn something about Notes :-)
0
FarWestCommented:
Thanks a lot for the info
But I'm now over 50 and last thing I know about Lotus was 123. 25 years ago
:)
0
Sjef BosmanGroupware ConsultantCommented:
Too old to learn? Well, so am I, maybe... By the way: what's outlook?
0
Seamus2626Author Commented:
Lotus notes is cruel lads, but its what i have to work with!!

So when i put in the below line, it runs over two lines in the editor but still comes out as one line in the body of the email (pic attached)

So i need it to split over two lines in the email so it appears as

Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report.

If you have any questions around the content of this report, please contact your regional SPM team in the first instance

Thanks!

MailDoc.Body = _
 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)" & _
    "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

Open in new window

Capture.PNG
0
Sjef BosmanGroupware ConsultantCommented:
Try with _Chr(13)_Chr(10)
0
Seamus2626Author Commented:
Sorry Sief, i have no idea where too put _Chr(13)_Chr(10)

I tried

 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report._Chr(13)_Chr(10) " & _
    "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

That's not working though
0
FarWestCommented:
not inside the string

MailDoc.Body = _
 "Following the communication of 24th February, please find attached the January 2015 version of your personal Horis portfolio Sales Manager report " & vbCRLf &  _
    "If you have any questions around the content of this report, please contact your regional SPM team in the first instance"

Open in new window

0
Sjef BosmanGroupware ConsultantCommented:
That would have been the idea, indeed. Well, I suppose that Notes doesn't support control characters in the string, so you'll have to revert to using a real rich-text item for Body. Don't forget to remove the current line with .Body ...

I don't have the exact code here, but it's something in the line of this:
body= MailDoc.CreateRichTextItem("Body")
body.AppendText "line1"
body.addNewline 1 
body.AppendText "line2"
body.addNewline 3 
body.AppendText "Yours truly,"

Open in new window

etc.
0
Seamus2626Author Commented:
Thanks guys!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Clients

From novice to tech pro — start learning today.