+ Reply to Thread
Results 1 to 15 of 15

Help with HTMLBody formatting

  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Help with HTMLBody formatting

    I am using a function to send emails using HTML.
    We are using .HTMLBody for the command for the email body.
    Here is the code we use:

    Please Login or Register  to view this content.
    We have the following issue:
    1.We use Temp_Body for geeting a string from a range from the Excel spreadsheet.
    It seems that temp_body has the formatting correctly for what is in the range however once used in the .HTMLBody it loses its formatting for line breaks between sentences.
    It puts all the sentences in the same line.
    Is there any way to work around this?

    2.We would like the Temp_Body to be formatted in the red color.
    We are using = "<font color=""""red"""">" which was advised by Daffodil11
    here is the link to the thread we got advice for

    http://www.excelforum.com/showthread...84#post4075984

    However his idea seems not to work any other ideas?
    Thank you for your help.

    Here is the sub code in full.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    Thank you for your help still seems not to be working correctly.
    I am not getting a error message however the email message does not seem to get the red color.

    I had another issue with the code and I posted a thread at the following link:

    http://www.excelforum.com/excel-prog...ormatting.html

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    vbNewLine should be "<br/>", VBNewLine is't valid HTML

  4. #4
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    Hi,

    Thank you for your reply I just removed the VBNewLine
    And still receiving a formatting issue with the spaces.
    Please advise

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    Well did you replace it or just remove it?


    Sent from my iPhone using Tapatalk

  6. #6
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    I just removed it.
    was Supposed to replace it?

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    Yes, have a re-read of my post

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting


  9. #9
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    I still do not understand what the answer is
    after reading all of your post .
    in this post I put a link to the other post.

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    That link isn't to the other post, it's to this post.

    Just replace vbNewLine in your code with "<br/>" it's very straightforward

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    I did what you suggested however it seems not add anything now to the body when sending an email.

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    Do you have the correct sheet active? That Macro requires the sheet you want to send be active when running it

  13. #13
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    I am not sending a sheet I just need the info from the range.
    After I added <br/> it stop sending the text from HTMLBody
    here is the code the way I have it

    Please Login or Register  to view this content.

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with HTMLBody formatting

    You still need the sheet active that has the range you want to send

  15. #15
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Help with HTMLBody formatting

    I activated the spreadsheet just on top of the command line of


    HTMLBody = "<font color=""""red"""">" & Temp_Body & "</font>" & "<br/>" & "<br/>" & RangetoHTML(rng) & Thank_You


    I do not see why activating the spreadsheet has anything to do with the text not appearing because when I use Debug.Print after getting the text in the range to Temp_Body it gives the right output

+ 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. How to insert signature in email using .HTMLbody
    By sugaprasad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2015, 06:28 AM
  2. [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
  3. Cell value in HTMLBody
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2011, 08:03 AM
  4. 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
  5. [SOLVED] outlook htmlbody
    By Erin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2005, 03:06 AM

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