How to add into combobox names of all the fonts?

A

avkokin

Hello.
I need to add into combobox of names of all the fonts from system. I
trying do it so:
For iFonts = 0 To Application.FontNames.Count
cmbFonts.AddItem Application.FontNames(i)
Next iFonts
But I get the error "Run-Time Error 5941"...
Please give me tips for my problem.
Thank you very much.
 
D

Doug Robbins - Word MVP

Use

Dim i As Long
With Application
For i = 1 To .FontNames.Count
cmbFonts.AddItem .FontNames(i)
Next i
End With

But, this will probably give you a better result

Dim i As Long
With Application
For i = 1 To .FontNames.Count
If Left(.FontNames(i), 1) <> "@" Then
cmbFonts.AddItem Application.FontNames(i)
End If
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
A

avkokin

Hello Doug! Thank you.
It's great! But I want to add to other combobox all tracing and color
of the fonts. The "FontColor" is not exists. How to do I want?
I will be grateful to you.
 

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