+ Reply to Thread
Results 1 to 2 of 2

Email from text box with formatting

  1. #1
    Registered User
    Join Date
    07-27-2021
    Location
    Riga, Latvia
    MS-Off Ver
    MS Excel for MS 365
    Posts
    1

    Lightbulb Email from text box with formatting

    I have a template for the email contained in a shape in an Excel sheet, and the text in this Shape also contains bold formatting.
    However, when I run my macros to create an email from this template it does not keep the formatting.
    Please advise what can be changed for below code to generate the email and keep the format the same as in Excel shape.

    Please Login or Register  to view this content.
    Last edited by viiktoryia; 07-28-2021 at 03:57 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,923

    Re: Email from text box with formatting

    You have two problems.

    The Text property of Characters does not return the format of the text, only the plain text. To extract the format, you will have to copy the text character by character, including the formatting for that character. I have not found a way to copy the text and bring the formatting with it. For example, if you run this code, it will show each character and the font, color, and bolding for that character:
    Please Login or Register  to view this content.
    So you will need a loop that adds the appropriate formatting for each character as you extract it from the text.

    The second problem is that the Body attribute of email does not have any formatting; it is plain text only. Even if you put formatted text into that field, the formatting would be lost. If you want formatting you have to use HTMLBody, and use HTML code for the formatting. For a bold character you would need to format it as

    <b>A</b>
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. [SOLVED] Generating Outlook Email and inseting chart into email with Text body.
    By Hyperion1571 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2019, 12:41 PM
  2. Replies: 1
    Last Post: 05-13-2018, 08:23 PM
  3. Sending Email with Email body in a cell keeping the formatting.
    By VBA_N_O_O_B in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2017, 11:35 PM
  4. [SOLVED] Creating email using Word document as email body – formatting lost
    By Chrispelletier in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-17-2016, 09:04 PM
  5. [SOLVED] Sending Email from a form button using text fields to build the email
    By jdoerr1021 in forum Access Tables & Databases
    Replies: 5
    Last Post: 06-05-2016, 10:22 PM
  6. Formatting Email Text
    By BennyAndTheInkJets in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2012, 10:45 AM
  7. Copy text and formatting in word doc to email
    By kaisermike in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2012, 04:59 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