How can my VBA code tell if a font is proportional or non-proportional ?

K

Ken Wan

Hi,
Is there a way to tell if a font is proportional or not? I could not find
relevant any properties in font object.
Thanks in advance for your help.
Ken
 
L

Larry

Here's a macro that does what you want, by looking for named fonts that
are fixed width fonts. All you would need to do is add to the list of
fixed-width fonts. There aren't many of them.

Select Case Selection.Font.Name
Case "Courier", "Courier New", "Lucida Console"
MsgBox "Font of selected text is FIXED WIDTH font.", vbOKOnly, "Font
Type"
Case Else
MsgBox "Font of selected text is PROPORTIONAL WIDTH font.", vbOKOnly,
"Font Type"
End Select

Larry
 
L

Larry

Also, you wouldn't need to select text for the macro to work. The
cursor simply has to be located in the text.

Larry
 
K

Ken Wan

Martinique,
I have not got around to try your second method. I will let you know after
I have tried it.
Thanks.
 
M

martinique

I'm actually kind of curious as to why you need to do this at all. What do
you do differently in your code if the font is fixed-width? What do you do
that loads new fixed-width fonts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top