ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get text metrics of fonts? (https://www.excelbanter.com/excel-programming/449496-get-text-metrics-fonts.html)

Robert Crandal[_3_]

Get text metrics of fonts?
 
Is it possible to get the font "text metrics" of charcters
typed in cells? It might be useful if I can find the
font width and height of each individual character in
a cell.

Thank you!




Claus Busch

Get text metrics of fonts?
 
Hi Robert,

Am Fri, 15 Nov 2013 01:55:00 -0700 schrieb Robert Crandal:

Is it possible to get the font "text metrics" of charcters
typed in cells? It might be useful if I can find the
font width and height of each individual character in
a cell.


characters has no with property. But you can read style and size:
Sub Test()
Dim i As Integer

For i = 1 To Len(Range("A1"))
With Range("A1").Characters(i, 1).Font
MsgBox .FontStyle & Chr(10) & .Size
End With
Next
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Claus Busch

Get text metrics of fonts?
 
hi again,

Am Fri, 15 Nov 2013 10:07:37 +0100 schrieb Claus Busch:

characters has no with property. But you can read style and size:

^^^^^^
characters.font has no WIDTH property


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com