+ Reply to Thread
Results 1 to 5 of 5

Email code. How to format specific lines in bold.

  1. #1
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Email code. How to format specific lines in bold.

    Hi there,

    I have a code that when clicking on a CommandButon, a new email is created.

    I need one of the lines in Bold.

    The code I am using is the following:

    Please Login or Register  to view this content.
    I have tried the code <b> but the same does not work.

    Anyone knows a code that format the above mentioned text?

    Your assistance will be higly appreciated.

    Many thanks in advance and kind regards,
    Filipe
    Last edited by pipoliveira; 10-09-2012 at 04:36 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Email code. How to format specific lines in bold.

    You need to set the HTMLBody property instead of Body, and use HTML tags for new paragraphs etc. Enter/paste the message text into an online HTML editor such as http://html-color-codes.info/html-editor/, set formatting and hyperlink as needed, then click the HTML icon to view the HTML and copy/paste it into VBA. For a VBA string you must replace each " in embedded strings (e.g. the href string) with "" or apostrophe ('). This gives:

    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Email code. How to format specific lines in bold.

    Hi Chippy,

    Thanks a million for the tip.

    I have changed on my code the .Body = strbody to .HTMLBody = strBody, then went to that link you provided and now I can set the lines I want in bold or other formatting.

    I had a small problem of the text font but I figure it out.

    I need now to type in the middle of a text, the value of a ComboBox as following:

    Please Login or Register  to view this content.
    I tried to put it between but the ComboBox value goes to next line as follow:

    Please Login or Register  to view this content.
    I need all text in the same line.

    Any ideas on how to set the code?

    Your feedback will be highly appreciated.

    Best regards,
    Filipe
    Last edited by pipoliveira; 10-13-2012 at 04:35 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Email code. How to format specific lines in bold.

    Quote Originally Posted by pipoliveira View Post
    I tried to put it between but the ComboBox value goes to next line as follow:

    Please Login or Register  to view this content.
    I need all text in the same line.
    Because there are 2 <p> tags. It should be:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Email code. How to format specific lines in bold.

    Thanks a million Chippy,

    It was so simple... sorry about that, I am new in VBA.

    Your contribution has been outstanding. Really appreciate it.

    Best regards,
    Filipe

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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