Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
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,137
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
  #2  
Old 02-26-2021, 05:27 AM
SamDsouza SamDsouza is offline General Question on List of Font Names Windows 10 General Question on List of Font Names Office 2013
Advanced Beginner
General Question on List of Font Names
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default

GMayor

Indeed Quick response

Instead of Listbox I've used Combobox. Hope you dont mind
Quote:
Try the following which adds all the font names to the list box ListBox1. On my PC the count is 660 fonts.
I am getting count as 160 in Msgbox

Quote:
How are you adding the names to the listbox
I really did not have idea to incorporate the Font names into Combo or Listbox. The method you have only showed by coding.

Quote:
On my PC the count is 660 fonts.
Are the 660 fonts on Word Document in Home button outof which only 160 fonts Count are for Textbox and Labels

SamD
Reply With Quote
Reply



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 02:18 PM.


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