+ Reply to Thread
Results 1 to 5 of 5

Email text in a cell - maintaining font format, spacing, line breaks in email body

  1. #1
    Registered User
    Join Date
    06-22-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Email text in a cell - maintaining font format, spacing, line breaks in email body

    I have the following text in cell A1 of my worksheet (Sheet1):
    -------------
    abc. 123.
    I am John.

    Regards,
    John

    -------------

    I have this code to create a email with the text in cell A1.

    Please Login or Register  to view this content.
    However, when the email is generated, the formatting, spacing, font of the text changes to a single line in Times New Roman, font size 12:
    ----------
    abc. 123. I am John. Regards, John
    ----------

    The question I have is, is there a code that can maintain the formatting/line breaks of the text in cell A1 in the email body?
    I am using Excel 2007 and Outlook 2007 (default: html message).
    Appreciate any help or sample code i can get. Thanks!
    Last edited by wkhor; 02-27-2012 at 02:10 AM.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Email text in a cell - maintaining font format, spacing, line breaks in email bod

    Please Edit your post #1 to include code tags. To edit your post, press Edit Post, press Go Advanced to see the [#] button). Highlight your code then press the [#] button. Press Save Changes. See the forum rules http://www.excelforum.com/forum-rule...rum-rules.html.
    To get the value in the same format as in the cell you need to split the string. So if the value is in A1
    Please Login or Register  to view this content.
    The delimiter for Alt Enter is Chr(10)
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    06-22-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Email text in a cell - maintaining font format, spacing, line breaks in email bod

    Hi Anthony,

    Sorry about that, i've added the CODE window.

    I've tried the code. Visually it works but the formatting isn't exactly the same in the email body.
    The text font in the email (HTML default) has changed to Calibri, font size 12. A space is also added at the end of each line.
    The line spacing has changed as well.

    Am I missing something? Thanks for your help!

    Is there another way?

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Email text in a cell - maintaining font format, spacing, line breaks in email bod

    You will have to play around with this to get it right.
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Email text in a cell - maintaining font format, spacing, line breaks in email bod

    Also have a look at this thread http://www.excelforum.com/excel-prog...ve-values.html. This will generate a HTML worksheet in a temporary workbook (which subsequently gets deleted) and then copies it over to outlook in HTML format.
    Last edited by smuzoen; 02-27-2012 at 03:15 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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