+ Reply to Thread
Results 1 to 18 of 18

Vba to draft html body in outlook

  1. #1
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Vba to draft html body in outlook

    Hi Team,

    I need help to update one of the vba codes that I am using to draft outlook emails.

    Below is the code that I am using to write in the body of the email. I am looking for the code that I have to add so that numbering is added to the sentences. I learned that <li> can add bullet points but I am looking for the numbering so if there are 10 sentences it is numbered from 1 to 10.

    Also there is an image that is pasted in the body of the email - "<img src='C:\Users\12345\Desktop\download.jpg'" & "width='400' height='200'><br>".

    I am trying to push this image alone to few centimeters to the right in the body of the mail. I tried adding spaces before the image but that didn’t work out.

    Please help.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Hi Team... Please help..

  3. #3
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    hi there,

    Can you please highlight the part that you want to be numbered?
    This is more an HTML Question then VBA :D
    You are Right with LI you can make a list and when you use <ul> it will be bullets but with <ol> you get an ordered list with numbers or letters.

    the HTML for a numbered list is this

    Please Login or Register  to view this content.
    Assuming you have the code you posted above in a for loop you would have to put the <ol type="1"> part outside the loop and then encapsulate the numbered parts in <li> </li>

  4. #4
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by LordLoki View Post
    hi there,

    Can you please highlight the part that you want to be numbered?
    This is more an HTML Question then VBA :D
    You are Right with LI you can make a list and when you use <ul> it will be bullets but with <ol> you get an ordered list with numbers or letters.

    the HTML for a numbered list is this

    Please Login or Register  to view this content.
    Assuming you have the code you posted above in a for loop you would have to put the <ol type="1"> part outside the loop and then encapsulate the numbered parts in <li> </li>
    Thanks a lot for your reply and sorry for not highlighting the part to be numbered..
    Below is the same code and the underlined sentences need to be numbered..
    I tried to update it myself but got compile error..

    Need your help please..

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    is it possible for you to upload a worksheet with your working code?
    The Data can be testdata but like this its very difficult to update your code.
    cause i can not tell how its working and how the output looks now with that piece of code
    Last edited by LordLoki; 07-13-2015 at 07:29 AM.

  6. #6
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by LordLoki View Post
    is it possible for you to upload a worksheet with your working code?
    The Data can be testdata but like this its very difficult to update your code.
    cause i can not tell how its working and how the putput looks now with that piece of code
    Sure.. Attached is the workbook.. The HTML body is where I need help..
    Attached Files Attached Files

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

    Re: Vba to draft html body in outlook

    You can't attach the image like that as the recipients will not have access to your desktop. You'll want to upload it somewhere everyone has access to

  8. #8
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    Hi Arun,

    Attached your workbook with numbers at the parts that you highlited.
    Hope that is what you need.

    If not send me a screenshot of the mail where i can see how the numbers should be.

    Greets
    Loki
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by Kyle123 View Post
    You can't attach the image like that as the recipients will not have access to your desktop. You'll want to upload it somewhere everyone has access to
    Can you please suggest a way forward.. Do you really need to look at the image because I need help to change the colour of sentences..

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

    Re: Vba to draft html body in outlook

    No, I don't need to see your image, but the recipients do. So you need to upload it to a place they all have access to

  11. #11
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    Hi arun,

    I changed the Code so that the Image will be attached to the mail and then shown embedded.
    This way the image does not need to be in a location where everyone has access.

    Make sure to add the location to the image here
    Please Login or Register  to view this content.
    And put the name of the file here after the cid: that needs to be the same as the name above

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by LordLoki View Post
    Hi arun,

    I changed the Code so that the Image will be attached to the mail and then shown embedded.
    This way the image does not need to be in a location where everyone has access.

    Make sure to add the location to the image here
    Please Login or Register  to view this content.
    And put the name of the file here after the cid: that needs to be the same as the name above

    Please Login or Register  to view this content.
    This is working really good as expected.. Thank you so much...

    I need one more help.. As mentioned in my initial request,I am trying to push this image alone to few centimeters to the right in the body of the mail...

    Requesting for your help..

  13. #13
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    Hi Arun,

    Change the HTML part to this

    Please Login or Register  to view this content.
    You can set how far by changing this part

    Please Login or Register  to view this content.
    Greets
    Loki

  14. #14
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by LordLoki View Post
    Hi Arun,

    Change the HTML part to this

    Please Login or Register  to view this content.
    You can set how far by changing this part

    Please Login or Register  to view this content.
    Greets
    Loki
    Thanks a lot.. This is working fantastic..

    The only thing is, after the image there is signature and that too is pushed to right..

    Can you please update so the image alone is moved to right all sentences after that is not moved..

    Please help..

  15. #15
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    Hm thats odd the div should only encapsulate the image. Will look into that later

    Gesendet von meinem HTC One mit Tapatalk

  16. #16
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Hi, please help in this request..

  17. #17
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Vba to draft html body in outlook

    problem is fixed with the code i offered for your problem in THIS Thread.

    my code was working fine but you forgot to close the div after the image in your code

  18. #18
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Re: Vba to draft html body in outlook

    Quote Originally Posted by LordLoki View Post
    problem is fixed with the code i offered for your problem in THIS Thread.

    my code was working fine but you forgot to close the div after the image in your code
    Thanks a lot... I am excited to see the codes working as expected.. This was great help..

+ 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. Using HTML Body Format in Outlook mail
    By akash kothari in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2014, 11:33 AM
  2. Excel ws into outlook html body with current html signature
    By Cadelanne in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2014, 09:03 AM
  3. Macro to send saved draft email from outlook in HTML format
    By jamesshakedown in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2013, 07:55 AM
  4. Problem with copying charts into html body outlook
    By katekatebobs in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-13-2013, 02:16 PM
  5. Send e-mail with image on body (.html) on e-mail manager <> outlook
    By mariotnc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:28 PM

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