![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
To get the fonts names try this
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 Ivan [ This Message was edited by: Ivan F Moala on 2002-07-21 23:22 ] |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2003
Posts: 4
|
Excellent Ivan!
I did a search and found this to be exactly what I was looking for. I appreciate it! Tom |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Jul 2002
Posts: 599
|
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?
__________________
Regards GNaga |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Yes, thats correct....
try something like this to get them... |
|
|
|
|
|
#6 | |
|
Board Regular
Join Date: Oct 2002
Location: Bergamo-Italy
Posts: 571
|
Quote:
Hi Ivan, but how can I get a sample for each font too? Tia.
__________________
Maurizio |
|
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
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
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Thanks Juan....I went away looking for the File
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Oct 2002
Location: Bergamo-Italy
Posts: 571
|
Thanks Juan to me, also.
__________________
Maurizio |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Oct 2002
Location: Bergamo-Italy
Posts: 571
|
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.
__________________
Maurizio |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|