Home Cells alignment in a vba created html outlook message
Reply: 1

Cells alignment in a vba created html outlook message

Danhadnagy
1#
Danhadnagy Published in 2018-02-14 16:22:48Z

I have to generate an email every day and I have to copy excel cells to the e-mail (only two columns but many rows). I'm using this function:

str = "<table>"
str = str & "<head><style>table, th, td {border: 1px solid black; border-collapse:" &  "collapse;}</style></head><body>"
getdata = str

I'm generating the email in this way:

With emailpod
    .BodyFormat = 3
    .display
    .To = Sheets("email").Range("H1").Value
    .cc = Sheets("email").Range("H2").Value
    .Subject = Sheets("email").Range("H3").Value & Sheets("email").Range("H6")
    .HTMLBody = Sheets("email").Range("H4") & "<br><br>" & Sheets("email").Range("H5") & "<br><br>" & _
        getdata & "<br>" & "Regards" & .HTMLBody & "</body>"

End With

I have borders for the cells but I also need align the cells to right inside the border. Any one knows how to do this?

braX
2#
braX Reply to 2018-02-14 17:08:58Z

Add this to your style (CSS)

td {text-align:right;}

So it would look like this:

str = str & "<head><style>table, th, td {border: 1px solid black; border-collapse:collapse;} td {text-align:right;} </style></head><body>"
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.328835 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO