View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default Font Index Numbers

Nice that you answered your own questions, and yes Excel 2000
would be using the new CharMap as I got the same results as you did.

You might also take a look at
Excel Developer Tip: Getting a List of Installed Fonts
http://www.j-walk.com/ss/excel/tips/tip79.htm
Suggest you start with an empty workbook because the
number of fonts will be overwhelming, for instance I could
not create a third column showing the italic version.

I made a modification to show the font in column B
that is indicated in column A.

Sub ShowInstalledFonts()
'--http://www.j-walk.com/ss/excel/tips/tip79.htm
Dim Fontlist, tempbar, i As Long
Set Fontlist = Application.CommandBars("Formatting").FindControl( ID:=1728)

' If Font control is missing, create a temp CommandBar
If Fontlist Is Nothing Then
Set tempbar = Application.CommandBars.Add
Set Fontlist = tempbar.Controls.Add(ID:=1728)
End If

' Put the fonts into column A
Range("A:B").ClearContents
Cells(1, 2) = "A stitch in time saves nine."
For i = 0 To Fontlist.ListCount - 1
Cells(i + 1, 1) = Fontlist.List(i + 1)
Cells(i + 1, 2).Formula = "=$B$1"
Cells(i + 1, 2).Font.Name = Fontlist.List(i + 1)
Next i

' Delete temp CommandBar if it exists
On Error Resume Next
tempbar.Delete
End Sub

I expect that this collection was not available when Stephen wrote
his code not that it matters how you get something done.
In fact when I run Stephen's code from Excel 2000 what I get is
is not the list of fonts that you see in Excel, but instead:a
list of character sets. (what codepages refer to)

Back to the original question and non programming solutions::
As far as I know fonts are know by their names not a number,
there is a number used for codepage that you do not see but that is
an arrangement table for what character you will see for each of the
256 characters in a byte.

Do you know about view the font list in it's own font
tools, customize, options (tab), list fonts in their own font

You can use the CharMap write out your phrase in characters to copy box:
A stitch in time saves nine.
then select the phrase, and then use the arrow key to go down through the
fonts in the CharMap.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"ben" wrote in message ...
I work in an office that does custom embroidery and logo, and I sometimes
recieve artwork without a font-name attached and I need to figure out which
font is being used. I have a cell ("a3") with the name I am trying to match
example ("Choir") and I have two buttons, next and last, i need to be able to
change to the next available font, or the last depending on the button i
press. I know how to change the fonts using the
selection.font.name="Fontname" Method but I need to know if it is possible to
use a number for the fonts or if there is a fontindex that returns the name
of the fonts available????
Tia
ben