Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2021, 04:52 AM
gmayor's Avatar
gmayor gmayor is offline General Question on List of Font Names Windows 10 General Question on List of Font Names Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



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
General Question on List of Font Names 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft