Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I am using excel VBA code to send an outlook mail. I am trying to add a background image for my table but it is not working. I tried multiple combination still it is not working. Here is my code. Please help.

This code is not working -
VB.NET
html = "<table width="60%" height="22%" align="center"></table> " & _
"<table width="60%" height="22%" align="center"><tbody><tr><td>" & _
"" & _
"" & _
"" & _
"" & _
"<table><tbody><tr><td align="center"><font size="5">HAPPY WORK ANNIVERSARY</font><br>Employee Name</td></tr><tr><td align="center"><font size="4">Team GOSC wishes you on achieving 2<br>years of service at Company.</font></td></tr><tr><td align="Center"><br><font style="color: rgba(192, 0, 0, 1)" size="4">Thank you for your continued dedication and hard work</font>" & _
"</td></tr><tr><td align="Center"><br><font style="color: rgba(192, 0, 0, 1)" size="4">From GOSC Community</font></td></tr><tr><td align="Center"></td></tr></tbody></table></td></tr></tbody></table>"


What I have tried:

Posted
Updated 5-Oct-20 2:16am
v2

1 solution

"it is not working" is not a helpful description of your problem - you should explain in detail what happens at all?
In the meantime, I can't see anywhere in your code that is even attempting to add a background image, which might explain why "it is not working".

You may have tried to use the background attribute on the table - this might work depending on the versions you are using as that attribute has been deprecated - see Table Background To Style HTML Tables Is Out (But CSS Is In) »[^] for more info.

You mention this is for outlook which does not use "standard" HTML but uses Word rendering see A Guide to HTML Background Images in Email | Email on Acid[^] for more information. Again, depending on versions, background images might not be supported at all.

I'm pretty sure background images in tables in Outlook are no longer supported - you canfind more information about placing the image on the email itself here - The Ultimate Guide to Background Images in Email - Litmus[^]
 
Share this answer
 
Comments
Member 14955525 5-Oct-20 8:35am    
Hi,
Thanks for input. Initially i had provided all the details but seems Code Project edited my question. No issue. Here is my full code which I am trying. Even i tried TR background also but it is not working. But if I use then it is taking the image. I have to display table background only.
This is the code I am trying but not working
table background='Wanniversary.png' width=60% height=22% align=center
CHill60 5-Oct-20 9:23am    
Well for a start you will have to put a path in front of the image file name. See my comments in my solution about whether or not you can actually do that in Outlook tables now
Member 14955525 5-Oct-20 9:35am    
I did that one also using full path still not working
CHill60 6-Oct-20 9:43am    
The background attribute on a table no longer works. See the links in my solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900