Get a list of all fonts in VBA Excel 2010

后端 未结 2 636
情深已故
情深已故 2021-01-23 18:40

I am working in excel VBA and I want to get the list of all fonts in a combo box

Can any one help me please

I tried this code but i am getting error in listcount

2条回答
  •  长情又很酷
    2021-01-23 19:17

    Another way to get the list of fonts (from Word)

    Option Explicit
    
    Sub listFonts()
        Dim wd As Object, fontID As Variant
    
        Set wd = CreateObject("Word.Application")
    
        For Each fontID In wd.FontNames
            Sheet1.cmbFonts.AddItem fontID
        Next
        wd.Quit
        Set wd = Nothing
    End Sub
    

提交回复
热议问题