Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Carriage Returns


Trying to put some carriage returns in an email I'm generating using MAPI in VB6 (kind of new to this, so forgive me if it's an easy one). Basically the email is being generated the way a normal email would, however I need to take this:

Date: nnnnnnn  Time: nnnnnn  Submitted by: xxxxx  Approved by: xxxxx

and make it this:

Submitted by
Approved by

The fields are being populated by textbox values on the form and also a combobox.

Any info is appreciated.

1 Solution
YourString = "Date: " & textbox.text & vbcrlf
youstring = yourstring & "Time: " & textbox.text & vbcrlf
youstring = yourstring & "Submitted by: " & combobox.value & vbcrlf
youstring = yourstring & "Approved by: " & textbox.text

Remark: replace the textbox.text and combobox.value by the appropriate values
Hi, celcius233.

What I've done is put a large, multiline "txtAll" textbox at the bottom of my form.  It grabs all the values of the other textboxes as follows:

     txtAll.Text = Textbox1 & vbNewLine & Textbox2 & vbNewline

Where Textbox1 = "Date: nnnnnnn", Textbox2 = "Time: nnnnnn", etc.

I'm auto-populating Outlook emails via code, so I need to replace vbNewline with HTML <br> tags; not sure if Mapi is the same.  I use the following string to populate my email's olMail.Body:

     Dim strTotalofTextboxes as String
     strTotalofTextboxes = Replace(txtAll.Text, vbNewLine, "<br>")

This works on a string like: Date:nnnnnnn  Time:nnnnnn  Submitted by:xxxxx  Approved by:xxxxx

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now