フォント フォントの一覧をシートに書き出す

※より実装に近く表示させる為、コードの改行を避けています。スマホ等で閲覧される際は向きを変えてご覧ください。

※実装するバージョンによってはバージョンアップの仕様により動作しないコードもあります。実装には動作確認の上ご使用下さい。


Sub UseFont()

Dim objcombo As CommandBarComboBox
Dim strFontName As String
Dim intFor As Integer
Dim sht As Worksheet
Dim lngThisRow As Long

Set sht = ActiveWorkbook.ActiveSheet
Set objcombo = CommandBars(4).Controls(1)

sht.Range("a1").Value = "FontName"

For intFor = 1 To objcombo.ListCount
strFontName = objcombo.List(intFor)
lngThisRow = sht.Range("a1").CurrentRegion.Rows.Count + 1
sht.Range("a" & lngThisRow).Value = strFontName
Next intFor

Set sht = Nothing
Set objcombo = Nothing

End Sub 

 

2000年01月01日|[VBサンプルコード]:[フォント]