How to split the one line to several lines

Roman F
Roman F used Ask the Experts™
on
good afternoon!
i  have the following statement:


strBody = strBody & ctl.Name & " : " & ctl.Value & vbCrLf

will produce the following output:

ID : 1 FName : Peter Frampton Email : Pframpton@gmail.com (all in one line)

is there   a way to break to the following:
ID : 1
FName : Peter Frampton
Femail : Pframpton@gmail.com

i tried: vbNewLine and chr(13) and & _: nothing is working ... unfortunately
could you help me to finish the task, please
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Paul Cook-GilesSenior Application Developer

Commented:
Use the same constant (vbCrLf) that you have at the end of the line where-ever you want a new line to start.  :)

Author

Commented:
i have that already: strBody = strBody & ctl.Name & " : " & ctl.Value & vbCrLf  
and does not work
Paul Cook-GilesSenior Application Developer

Commented:
You've already got something in strBody before you get to the line you quoted, so you'll need to modify the string that is in strBody before concatenating it with ctl.Name & " : " & ctl.Value.

something like this:

ctl = me.ID
strBody =  ctl.Name & " : " & ctl.Value & vbCrLf

ctl = me.FName
strBody =  strBody & ctl.Name & " : " & ctl.Value & vbCrLf

ctl = me.Email
strBody =  strBody & ctl.Name & " : " & ctl.Value & vbCrLf

Open in new window


But frankly, that's the long way around;  this will produce the same result:

strBody = "ID : " & me.ID & vbCrLf & "FName : " & me.Fname & vbCrLf & "Femail : " & me.Femail

Open in new window

How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

NorieAnalyst Assistant

Commented:
Where do you want to display the string?

Author

Commented:
it is going inside the email body

On Error Resume Next
Dim ctl As Control
Dim strBody As String
For Each ctl In Me.Controls
          strBody = strBody & ctl.Name & " : " & ctl.Value & vbCrLf
Next
SendHTMLEmail Me.SEmail, "Test", strBody, False
End Sub
Top Expert 2014
Commented:
If the email is in HTML format, use "<BR>" instead of vbCrLf

Author

Commented:
YOU ARE THE ONE!!!!!!!!! THANK YOU!!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial