+ Reply to Thread
Results 1 to 4 of 4

Retain the text format for a Email Body while sending mail with VBA

  1. #1
    Registered User
    Join Date
    09-16-2017
    Location
    Agra
    MS-Off Ver
    2013
    Posts
    72

    Retain the text format for a Email Body while sending mail with VBA

    Disclaimer : I am also posting for help in other expert forums also . Hope this is not a breach to use this forum.

    I am using a Macro at my office which uses concatenation of six variable lines since I wanted to introduce " Next Line" . However the problem i identified is that when the code is executed to send email, the email body is loses all its format and uses simple text format in email.

    Question - Can I Use one Cell , lets say A1 and put my mail body in the format I wish and VBA can pull this cell "As it is" . "As it is the Key" here. Please help.


    Untitled picture.png

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Retain the text format for a Email Body while sending mail with VBA

    I would suggest that you switch to using HTML format for the e-mail and build the necessary tags for the formatting into your code. I've done this in similar situations.
    Martin

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: Retain the text format for a Email Body while sending mail with VBA

    .
    Basic example :

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Retain the text format for a Email Body while sending mail with VBA

    The following is a simple working example using .HTMLbody for multiple lines. HTML uses '<br>' for the newline character instead of Carriage Return / Linefeed.

    Please Login or Register  to view this content.
    To convert existing code that has carriage return linefeed into HTML compatible code use a construction like:
    Please Login or Register  to view this content.
    I hope this helps.

    NOTE: Firewall prevents use of actual code. Replace qqq with < in all code above (3 places)

    Lewis
    Last edited by LJMetzger; 11-05-2017 at 11:52 AM.

+ 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. After sending e-mail, body-text is gone
    By Marloes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 05:29 AM
  2. Retain the colors and different style in Body of email
    By gujugolf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2013, 08:46 PM
  3. Replies: 4
    Last Post: 02-27-2012, 03:13 AM
  4. Excel 2007 : Email 2007 excel format in body of mail
    By dbdanboat in forum Excel General
    Replies: 1
    Last Post: 01-21-2011, 07:47 AM
  5. Format text in e-mail body
    By mabbutt in forum Outlook Formatting & Functions
    Replies: 4
    Last Post: 09-28-2009, 04:22 AM
  6. How to format text when sending mail to Outlook?
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2008, 11:18 AM
  7. [SOLVED] Body Text properties when sending email through Lotus Notes via Macro
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2006, 11:15 AM
  8. Formating Body When Sending Mail
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2005, 08:05 AM

Tags for this Thread

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