+ Reply to Thread
Results 1 to 4 of 4

HTMLBody not correctly formatting text from a group of cells

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    HTMLBody not correctly formatting text from a group of cells

    Hi all,

    I am using HTMLBody to poulate an email from source data within a worksheet.

    Everything works okay with the exception of & "<i>" & stringbody & "</i><br><br>" _.

    Stringbody refers to a group of merged cells that use Alt+Enter to add new line. Despite numerous new lines being created, when the text is added to the email it is displayed as one single line of text.

    Is there a way of HTMLBody adding the required new lines to the text so it appears as it does in the merged cells??

    Merged Cells text:
    Test

    Test

    Test

    Email output text:
    Test Test Test

    HTMLBody code:
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 06-06-2025 at 11:01 AM. Reason: please use code tags

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

    Re: HTMLBody not correctly formatting text from a group of cells

    The ALT+ENTER character is a line feed (code 10). Line breaks and extra spaces are ignored in HTML. Try this:

    Please Login or Register  to view this content.
    Also please use CODE tags. I have updated your post this time but please keep in mind for the future:

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however we recommend that you include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: HTMLBody not correctly formatting text from a group of cells

    Apologies for the error in the post and thanks for correcting it.

    Your solution works perfectly 👍☺️

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

    Re: HTMLBody not correctly formatting text from a group of cells

    Glad it worked, cheers!

+ 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. Copy formatting, text, formula and location of a group of cells to another workbook
    By DuckLife in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2021, 10:31 PM
  2. Replace text in HTMLBody
    By ldoodle in forum Outlook Programming / VBA / Macros
    Replies: 10
    Last Post: 06-24-2018, 08:50 AM
  3. Help with HTMLBody formatting
    By starlev in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-20-2015, 10:00 AM
  4. [SOLVED] Change Font formatting mid-sentence of HTMLBody Outlook mail
    By askpcguy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-31-2014, 09:47 PM
  5. Linking Cells - Can't copy formatting correctly
    By MichaelWake1 in forum Excel General
    Replies: 2
    Last Post: 09-21-2010, 12:06 PM
  6. Email specific range of cells using .htmlbody
    By Jason Smith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-19-2008, 03:01 PM
  7. [SOLVED] Formatting a group of cells for text
    By Lee in forum Excel General
    Replies: 4
    Last Post: 02-25-2006, 02:40 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