+ Reply to Thread
Results 1 to 8 of 8

Display a multi-line text box from User Form in a generated outlook e-mail

  1. #1
    Registered User
    Join Date
    11-04-2013
    Location
    Chesham
    MS-Off Ver
    Excel 2010
    Posts
    33

    Display a multi-line text box from User Form in a generated outlook e-mail

    I have a User Form that is populated with event information.

    One of the fields populates information (Additional Information) in a cell that contains multiple lines of text.

    The user can edit this field and when they click "preview" a procedure creates an e-mail in outlook with the event information and edited information.

    However the additional information field with multiple lines, when referenced in the body of the e-mail, displays on one line.

    I did expect this because to create new lines in the e-mail within vba I have to use html ("<br>") which isn't used nor really can be used by the user in the User Form.

    If anyone can think of a way around this (reference this field but have it displayed as multi-lined in the e-mail) it would be very much appreciated.

    Hopefully the below part helps in showing what I'm trying to do ("AI" is the field with mulitple lines I'm trying to display in the e-mail as multi lined):

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    Hi,

    You can try it with:
    Please Login or Register  to view this content.
    If vbnewline don't work, you can change it into vbCrLf
    Greetings,

    Cheetahke

  3. #3
    Registered User
    Join Date
    11-04-2013
    Location
    Chesham
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    thanks for your help, its still displaying the e-mail as one line though

    I tried vbnewline and vbcrlf wrote it in like this, is that right?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    Hi,

    I think you have to put this:

    Please Login or Register  to view this content.
    instead of:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-04-2013
    Location
    Chesham
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    thanks I appreciate your help, unfortunately the outlook message still displays the additional information field all on one line. I'll keep trying

  6. #6
    Registered User
    Join Date
    11-04-2013
    Location
    Chesham
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    If anyone is looking to a solution to this I have come to the conclusion that there isn't one without the user adding either "<br>" (html) or vbnewline in the User Form field, depending on whether the body of the e-mail is html or not.

    The only way around it to have multiple text boxes in the User form for each line, in your code reference each field and add a line break (as above) if field is not blank, any empty fields won't display, any filled in fields will appear with a line break after them.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    Quote Originally Posted by Tnashnhsp1 View Post
    If anyone is looking to a solution to this I have come to the conclusion that there isn't one without the user adding either "<br>" (html) or vbnewline in the User Form field, depending on whether the body of the e-mail is html or not.

    The only way around it to have multiple text boxes in the User form for each line, in your code reference each field and add a line break (as above) if field is not blank, any empty fields won't display, any filled in fields will appear with a line break after them.
    This will replace the ASCII line feeds in the text to HTML line breaks

    Please Login or Register  to view this content.
    You may have to use vbCr or vbCrLf instead of vbLf depending on the ASCII character used in the text.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  8. #8
    Registered User
    Join Date
    11-04-2013
    Location
    Chesham
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Display a multi-line text box from User Form in a generated outlook e-mail

    worked perfectly! many thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run *.bat once the outlook mail received with Subject line "welcome" on daily by user
    By yogananda.muthaiah in forum Outlook Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2021, 10:23 AM
  2. Display multi line text in sub item of a listview .
    By priya06manohar@gmail in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2014, 02:43 PM
  3. First Post - Outlook E-Mail reminders generated from Excel
    By crispybadger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2012, 05:32 PM
  4. Add e-mail address to Outlook Msg generated in Excel
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2010, 05:33 PM
  5. user form question: text box to display result
    By BigPig in forum Excel General
    Replies: 0
    Last Post: 02-27-2006, 08:40 PM
  6. user form question: text box to display result
    By BigPig in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-25-2006, 04:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1