Font Sizing in HTML

DougRobertson

Active Member
Joined
Sep 22, 2009
Messages
334
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am using HTML code within VBA to create the text within the Macro-generated emails.

Using Font Size 2 in HTML will give me a font size of 10 in my email.
Using Font Size 3 in HTML will give me a font size of 12 in my email.

Is there any way of over-riding this method, as I need to get an actual font size of 11 for the text in my email.

Many thanks in advance for any assistance on this!

~ DWR
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Doug

How are you specifying the font size?
 
Upvote 0
Try experimenting with using other units, e.g. px.
HTML:
<font size='10px'>
 
Upvote 0
If you send an HTML mail and 'View Code' in the Sent Mail item you'll see Excel uses point sizes.
Not sure how it does conversions. 18px for example is converted to 13.5pt

HTML:
< span style='font-size:8.0pt' >Text< /Span >

I found this, which seems to agree 13.5 *96/72 =18px
http://www.itjungles.com/point-to-pixel-conversion.html
 
Last edited:
Upvote 0
daverunt

Forgot that you could use pt as a unit for font size, that's probably what the OP needs.
 
Upvote 0
Yep, I never use them though.
Found a converter calc above - useful for future
 
Upvote 0
Gentlemen! The span style code is EXACTLY what I've been looking for, for about 5 years now!

Thank you both very much, and blessings upon you.
 
Upvote 0
We're glad to help.
I calculated 8.25pt as 11px but found Excel rounded up to 8.5 in the mail.
 
Upvote 0
It is SO great to have complete control now over the look of all my company's Macro-generated emails - thanks again!

However, I've done some experimentation, and have found that at least with my system, all I have to do is use the code you suggested, with actual Outlook font sizes, and it always works. Am I missing something that could cause trouble down the line?

I declare the variable
iOutlookFONTSize11
to be the hard number 11, then use it in the following code:

'<span style='font-size:" & iOutlookFONTSize11 & "pt'>

... and it works like a charm with numerous sizes.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,225
Messages
6,129,596
Members
449,520
Latest member
TBFrieds

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top