vba - create html table and have table header span more than one column -


i sending e-mail excel using outlook. body of e-mail making use of html.

i had table working fine. have been asked add header above current header of table. header called "premium / (discount)". code below fine. header span across 2 columns , centre.

i using line below not working, why?

"<th colspan='2'>premium /(discount)</th>   msg = "<table style='font-size: 12pt;'><tr><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th>" & _     "<th colspan='2'>premium /(discount)</th><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th><th>&nbsp</th></tr>" & _     "<tr><th align='left'>fund</th><th>&nbsp;</th>" & _     "<th align='left'>market spread %</th><th>&nbsp;</th>" & _     "<th align='left'>tolerance</th><th>&nbsp;</th>" & _     "<th align='left'>bid %</th><th>&nbsp;</th>" & _     "<th align='left'>ask %</th><th>&nbsp;</th>" & _     "<th align='left'>tolerance</th><th>&nbsp;</th>" & _     "<th align='left'>extra notes</th><th>&nbsp;</th></tr>" 

according code, table has total of 14 columns, colspan should of 14 instead of 2.

also, you're using of these columns space : <th>&nbsp;</th>. note can better adding cell-padding value (in pixels) <table>, table : http://cssdeck.com/labs/qyh7ytdi.

here code should trick:

msg = "<table style='font-size: 12pt;' cellpadding='5'>" & _       "<tr><th colspan='3'></th><th colspan='2'>premium /(discount)</th></tr>" & _       "<tr><th align='left'>fund</th>" & _       "<th align='left'>market spread %</th>" & _       "<th align='left'>tolerance</th>" & _       "<th align='left'>bid %</th>" & _       "<th align='left'>ask %</th>" & _       "<th align='left'>tolerance</th>" & _       "<th align='left'>extra notes</th></tr>" 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -