+ Reply to Thread
Results 1 to 5 of 5

e-mail sheet in html and attach a spreadsheet

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    Brazil
    MS-Off Ver
    O365 Win
    Posts
    63

    e-mail sheet in html and attach a spreadsheet

    I use Office 365, Windows

    I would like to send an e-mail with one sheet as a body html, and another sheet attached to it.

    Was able to find online two vba codes by Ron de Buin working on their own, and I was able to merge them together. The only problem I am facing is that the HTML part is coming on black and white, I would love it to come with the conditional formatting, as well as the normal formatting, also, is it possible to include text box and image (logo)?

    Please Login or Register  to view this content.

  2. #2
    Banned User!
    Join Date
    01-17-2021
    Location
    Omaha, NE
    MS-Off Ver
    office 2016
    Posts
    211

    Re: e-mail sheet in html and attach a spreadsheet

    what you mean the HTML part is ''coming on black and white''? you mean table is being stripped of formatting you did put yourself into it? there is also stuff wrong with your code i think. this
    Please Login or Register  to view this content.
    opens file but this
    Please Login or Register  to view this content.
    i dont think matters in terms of what you want to see in the html body of email. and this
    Please Login or Register  to view this content.
    is just stream. stream doesnt preserve html code and formats i dont htink. then you put result from that routine in html body with this
    Please Login or Register  to view this content.
    but you have to know that html table formatting is not the same as table sitting in excel sheet. the < table > element in html has many many css stylings. inline many others. but you can only do inline because html body of email object in outlook can not see external or linked css file. that only for web applications. also, i do not think you need this
    Please Login or Register  to view this content.
    if you use .htmlBODY property, body format is changed automatically i think. microsoft knows though. but the enumeration is right yes

    https://docs.microsoft.com/en-us/off...k.olbodyformat

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    Brazil
    MS-Off Ver
    O365 Win
    Posts
    63

    Re: e-mail sheet in html and attach a spreadsheet

    Quote Originally Posted by omahaNative_1023 View Post
    what you mean the HTML part is ''coming on black and white''? you mean table is being stripped of formatting you did put yourself into it? there is also stuff wrong with your code i think. this
    Thank you, yes, it comes out as black and white instead of the colors. I don't know a lot of VBA coding, I google what I want to do, find some results, and try to accommodate to my needs.
    Which is why there are a lot of things there that today are unnecessary, but honestly I have no idea what most of the stuff means

    I also found a version of a VBA code which prints out the table on mail format perfectly, including the colors and color formatting. For instance negative number red, positive green. Do you know if there's a way to include images?

    Here's the other VBA code which works with the colors, but I couldn't get this to work along with the other. It copied the range from a different sheet, and by changing Sheet:=ActiveSheet.Name, to Sheets("Graph") would give me a blank e-mail instead.

    Please Login or Register  to view this content.

  4. #4
    Banned User!
    Join Date
    01-17-2021
    Location
    Omaha, NE
    MS-Off Ver
    office 2016
    Posts
    211

    Re: e-mail sheet in html and attach a spreadsheet

    guess i not understand what you need. well are you saying that the table you want in the email you want colors in it? because if that it, no of course it is not going to do that. like I said, html produce colors based on the html code you write. you have to write markup insside the email! you know html markup? they call it 'inline'

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: e-mail sheet in html and attach a spreadsheet

    You will need to use the WordEditor method to copy/paste a range as a picture rather than htmlBody method. e.g.
    Please Login or Register  to view this content.

+ 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] Help with vba, try to attach single sheet to mail and open before i send it
    By dodde in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-16-2019, 04:04 PM
  2. Replies: 0
    Last Post: 05-19-2017, 12:05 PM
  3. click on mail address, print specific page to pdf, attach it to mail
    By Crosplit in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-09-2013, 04:54 AM
  4. Replies: 9
    Last Post: 07-02-2013, 02:41 AM
  5. code to attach the draft mail in new compose mail as attachment in outlook 2010
    By priya1987 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2012, 08:38 AM
  6. How do I e-mail one Excel sheet to arrive NOT in HTML
    By southwest worker in forum Excel General
    Replies: 1
    Last Post: 06-30-2006, 04:45 PM
  7. Mail Single sheet as HTML(HTM) file
    By argi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2005, 02:05 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