List all Font Names in a Range ...

G

Guest

Guest
Hi,

I would like to list all available Fonts, but not the file name ("abac.ttf") but the Font name ("Abadi MT Condensed").
In fact it's for applying the font to the next column.

Range("A1").Font.Name = "abac.ttf" ==> runs but it doesn't work like :
Range("A1").Font.Name = "Abadi MT Condensed"

Thanks,
Alx.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
To get the fonts names try this<pre/>
Sub GetFonts()
Dim Fonts
Dim x As Integer

Range(Cells(1, 1), Cells(1, 1).End(xlDown)).Select '.ClearFormats
x = 1
Set Fonts = Application.CommandBars.FindControl(ID:=1728)

On Error Resume Next
Do Until Err<> 0
Cells(x + 1, 1) = Fonts.List(x)
x = x + 1
Loop

Range("A1").FormulaR1C1 = "=""Font List = "" & COUNTA(R[1]C:R[500]C)"

With Range("A1")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "Arial"
.Font.FontStyle = "Bold"
.Font.Size = 10
.Font.Strikethrough = False
.Font.Superscript = False
.Font.ColorIndex = 5
.Font.Interior.ColorIndex = 15
End With
Columns("A:A").EntireColumn.AutoFit

Set Fonts = Nothing

End Sub</pre>


Ivan
This message was edited by Ivan F Moala on 2002-07-21 23:22
 
Upvote 0
Set Fonts = Application.CommandBars.FindControl(ID:=1728)

Ivan where from we get all the commandbar ID number? ID 1728 belongs to font name dropdown box control in the format command bar am I right?
 
Upvote 0
Ivan F Moala said:
To get the fonts names try this<pre/>
Sub GetFonts()
Dim Fonts
Dim x As Integer

Range(Cells(1, 1), Cells(1, 1).End(xlDown)).Select '.ClearFormats
x = 1
Set Fonts = Application.CommandBars.FindControl(ID:=1728)

On Error Resume Next
Do Until Err<> 0
Cells(x + 1, 1) = Fonts.List(x)
x = x + 1
Loop

Range("A1").FormulaR1C1 = "=""Font List = "" & COUNTA(R[1]C:R[500]C)"

With Range("A1")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "Arial"
.Font.FontStyle = "Bold"
.Font.Size = 10
.Font.Strikethrough = False
.Font.Superscript = False
.Font.ColorIndex = 5
.Font.Interior.ColorIndex = 15
End With
Columns("A:A").EntireColumn.AutoFit

Set Fonts = Nothing

End Sub</pre>


Ivan
This message was edited by Ivan F Moala on 2002-07-21 23:22


Hi Ivan,
but how can I get a sample for each font too?

Tia.
 
Upvote 0
Loop through each cell and do something like

Code:
For Each Cll In Range("A2", Range("A65536").End(xlUp))
    Cll.Font.Name = Cll.Value
Next Cll
 
Upvote 0
Hi Juan Pablo,
using:

For Each Cll In Range("A2", Range("A65536").End(xlUp))
Cll.Font.Name = Cll.Value
Next Cll

with excel 97 after 150 fonts I get "Insufficient memory" and then error 404, not with excel XP.
Any solution for old excel 97?

Tia.
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,428
Members
448,896
Latest member
MadMarty

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