![]() |
|
#2
|
||||
|
||||
|
How are you adding the names to the listbox.
Try the following which adds all the font names to the list box ListBox1. On my PC the count is 660 fonts. Code:
Private Sub UserForm_Initialize()
Dim arrFonts As Variant
Dim lng_Index As Long
With ListBox1
.Clear
ReDim arrFonts(Application.FontNames.Count - 1)
For lng_Index = 0 To Application.FontNames.Count - 1
arrFonts(lng_Index) = Application.FontNames(lng_Index + 1)
Next lng_Index
SortArray arrFonts
.List = arrFonts
MsgBox .ListCount
End With
End Sub
Private Function SortArray(Arr As Variant) As Variant
Dim i As Long
Dim j As Long
Dim Temp As Variant
For i = LBound(Arr) To UBound(Arr) - 1
For j = i + 1 To UBound(Arr)
If UCase(Arr(i)) > UCase(Arr(j)) Then
Temp = Arr(j)
Arr(j) = Arr(i)
Arr(i) = Temp
End If
Next j
Next i
SortArray = Arr
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| General question about forms | JGilrain | Word | 6 | 03-15-2019 07:14 AM |
| General Question | Magdalen | Word | 3 | 02-09-2018 07:05 AM |
| 2 general question about coding | puff | Excel Programming | 1 | 12-07-2017 08:53 AM |
Excel General Question
|
Excel#1 | Excel | 1 | 07-09-2015 11:16 PM |
| General VBA Question | velohead | Word VBA | 0 | 07-05-2010 10:41 PM |