office交流網(wǎng)--QQ交流群號(hào)及微信交流群

Access培訓(xùn)群:792054000         Excel免費(fèi)交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請(qǐng)用微信掃碼)

        

Excel提取系統(tǒng)安裝的字體列表

2021-01-15 08:00:00
tmtony8
原創(chuàng)
3665

在創(chuàng)建的應(yīng)用程序中, 我們輸入信息可以用文本框,但是文本框是單純的文本文字,沒(méi)有其他格式

可以用富文本控件,富文本編輯器是帶有格式的。

我們也可以調(diào)用系統(tǒng)的文字格式。下面的代碼,可以獲取系統(tǒng)安裝的字體名稱。


Sub ShowInstalledFonts()
    Dim FontList As CommandBarControl
    Dim TempBar As CommandBar
    Dim i As Long
    

    Set TempBar = Application.CommandBars.Add
    Set FontList = TempBar.Controls.Add(ID:=1728)
    

    Range("A:A").ClearContents     '字體逐個(gè)添加到A列中
    For i = 0 To FontList.ListCount - 1
        Cells(i + 1, 1) = FontList.List(i + 1) 
    Next i
    
  
    TempBar.Delete   '清空內(nèi)容
End Sub



點(diǎn)擊按鈕,字體名稱添加到A列中,該按鈕代碼如上

    分享
    文章分類
    聯(lián)系我們
    聯(lián)系人: 王先生
    Email: 18449932@qq.com
    QQ: 18449932
    微博: officecn01
    移動(dòng)訪問(wèn)