Vba Excel vbscript返回Excel中可用的字体数

Vba Excel vbscript返回Excel中可用的字体数,vba,excel,Vba,Excel,是否可以访问excel中可用的字体 我意识到您可以通过以下方式设置字体: Range("A1:C1").Select With Selection.Font .Name = "Arial" End With 我想做的是返回excel中的字体数,然后循环遍历它们以获得每种字体的名称 比如: For Counter = 1 To excel.fonts ActiveCell = excel.font.Name Next Counter 这应给出计数并

是否可以访问excel中可用的字体

我意识到您可以通过以下方式设置字体:

 Range("A1:C1").Select
     With Selection.Font
         .Name = "Arial"
     End With
我想做的是返回excel中的字体数,然后循环遍历它们以获得每种字体的名称

比如:

For Counter = 1 To excel.fonts
   ActiveCell = excel.font.Name
Next Counter

这应给出计数并列出名称:

Sub dural()
   Dim FontList
   Dim i As Long
   Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728)

   MsgBox FontList.ListCount

   For i = 1 To FontList.ListCount
       Cells(Rows.Count, 1).End(xlUp)(2) = FontList.List(i)
   Next i
End Sub
从吉普车的柱子上


这应该给出计数并列出姓名:

Sub dural()
   Dim FontList
   Dim i As Long
   Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728)

   MsgBox FontList.ListCount

   For i = 1 To FontList.ListCount
       Cells(Rows.Count, 1).End(xlUp)(2) = FontList.List(i)
   Next i
End Sub
从吉普车的柱子上


热爱你的工作,加里,工作得很有魅力。以前没有遇到过Application.CommandBars,我们将非常感谢。@约翰请注意改编自Jeeped的代码Hanks Gary感谢你为我指出Jeeped帖子的方向。热爱你的工作Gary,工作起来很有魅力。以前没有遇到过Application.CommandBars,我们将对此进行研究,非常感谢。@John请注意改编自Jeeped的代码Hanks Gary感谢您为我指出Jeeped帖子的方向。